[fpc-pascal] How to free this memory and avoid memory leak

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Oct 8 16:01:32 CEST 2009


On 08 Oct 2009, at 15:58, Alexey Voytsehovich wrote:

> Thursday, October 8, 2009, 4:51:34 PM, you wrote:
>> //  Finalize(tocarray);                        <--- doesn't work
>>  Finalize(tocarray, _header.ntoc);       <--- doesn't work
>>  tocarray := nil;                                  <--- doesn't work
>
> SetLength(tocarray, 0); ?

None of these are required, dynamic arrays are automatically finalised  
when the function exits.


Jonas



More information about the fpc-pascal mailing list