[fpc-pascal] dynamic arrays behaving funny

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Nov 13 00:14:13 CET 2008


On 12 Nov 2008, at 22:46, Marc Santhoff wrote:

> Am Mittwoch, den 12.11.2008, 22:30 +0100 schrieb Jonas Maebe:
>> On 12 Nov 2008, at 21:53, Marc Santhoff wrote:
>>
>>
>> Getmem allocates memory, but does not perform any initialisation. Use
>> new() for record types containing fields that must be initialised
>> (such as all reference counted types).
>
> That does work. :)
>
> So the caller has to use Dispose() instead of FreeMem() or will the  
> work
> the same?

It's the same deal: freemem frees record's memory but does not  
finalise its contents, so you get memory leaks. Use dispose.


Jonas



More information about the fpc-pascal mailing list