[fpc-pascal] replacement of MARK and RELEASE function in free pascal

Sven Barth pascaldragon at googlemail.com
Thu Jun 19 15:28:42 CEST 2014


On 19.06.2014 13:29, Karoly Balogh (Charlie/SGR) wrote:
> So either you use mypointer:=GetMem(size); or GetMem(mypointer, size);
> both are valid. If you need to allocate heap space for a record,
> use New/Dispose, or GetMem(myptr, sizeof(Tmyrecord));

I wouldn't use GetMem() in case of record pointers just in case a 
managed type happens to be in there. Unlike GetMem() New() does 
initialize those fields correctly. Alternatively one should use 
Initialize(myptr^) after the call to GetMem().

Regards,
Sven




More information about the fpc-pascal mailing list