[fpc-pascal] AddTerminateProc leak?

silvioprog silvioprog at gmail.com
Thu Mar 5 03:45:08 CET 2015


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!

-- 
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/20150304/bc5cfb31/attachment.html>


More information about the fpc-pascal mailing list