[fpc-devel] heaptrc: error in linked list of heap_mem_info
Tom Verhoeff
T.Verhoeff at tue.nl
Wed Dec 12 15:46:42 CET 2007
When I use HeapTrc on a small program (FPC 2.2.0 on Linux; FPC 2.0.4 on
Mac OS X) and set
QuickTrace := False
KeepReleased := True
this results in a long list of
error in linked list of heap_mem_info
error in linked list of heap_mem_info
...
When either QuickTrace or KeepReleased is kept at its default value,
this does not happen.
It also heappens in the heaptrace example program:
Program heapex;
{ Program used to demonstrate the usage of heaptrc unit }
Uses heaptrc;
Var P1 : ^Longint;
P2 : Pointer;
I : longint;
begin
QuickTrace := False; // ADDED
KeepReleased := True; // ADDED
SetHeapTraceOutput('heaptrc.out'); // ADDED
New(P1);
// causes previous allocation not to be de-allocated
New(P1);
Dispose(P1);
For I:=1 to 10 do
begin
GetMem (P2,128);
// When I is even, deallocate block. We loose 5 times 128
// bytes this way.
If (I mod 2) = 0 Then FreeMem(P2,128);
end;
GetMem(P2,128);
// This will provoke an error and a memory dump
Freemem (P2,64);
end.
Any suggestions? Or is this combination asking for trouble
(in which case it would be good to mention this in the documentation)?
Thanks,
Tom
--
E-MAIL: T.Verhoeff @ TUE.NL | Dept. of Math. & Comp. Science
PHONE: +31 40 247 41 25 | Technische Universiteit Eindhoven
FAX: +31 40 247 54 04 | PO Box 513, NL-5600 MB Eindhoven
http://www.win.tue.nl/~wstomv/ | The Netherlands
More information about the fpc-devel
mailing list