[fpc-pascal] AddTerminateProc leak?
silvioprog
silvioprog at gmail.com
Thu Mar 5 21:06:37 CET 2015
On Wed, Mar 4, 2015 at 11:45 PM, silvioprog <silvioprog at gmail.com> wrote:
> Hello,
>
> The test:
>
> === begin code ===
>
> program project1;
>
> uses
> heaptrc,
> SysUtils;
>
> function _Finalize: boolean;
> begin
> WriteLn('END');
> Result := True;
> end;
>
> begin
> WriteLn('START');
> AddTerminateProc(@_Finalize);
> WriteLn('END 1');
> Sleep(1000);
> DeleteFile('HT.TXT');
> SetHeapTraceOutput('HT.TXT');
> end.
>
> === end code ===
>
> The result:
>
> === begin trace ===
> Heap dump by heaptrc unit
> 50 memory blocks allocated : 1226/1344
> 49 memory blocks freed : 1218/1336
> 1 unfreed memory blocks : 8
> True heap size : 196608 (112 used in System startup)
> True free heap : 196416
> Should be : 196424
> Call trace for block $0018F150 size 8
> $BAADF00D
> $BAADF00D
> $BAADF00D
> $BAADF00D
> $BAADF00D
> $BAADF00D
> $BAADF00D
> $BAADF00D
> === end trace ===
>
> The leak is returned even calling the CallTerminateProcs function.
>
> I did something wrong or is it really a leak?
>
> Thank you!
>
Delphi 7+ has the SysUtils.FreeTerminateProcs procedure that frees the
method added via the SysUtils.AddTerminateProc procedure.
I'll make a patch implementing it ...
Thank you!
--
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150305/1574207f/attachment.html>
More information about the fpc-pascal
mailing list