[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;

  QuickTrace := False; // ADDED
  KeepReleased := True; // ADDED
  SetHeapTraceOutput('heaptrc.out'); // ADDED
  // causes previous allocation not to be de-allocated
  For I:=1 to 10 do
      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);
  // This will provoke an error and a memory dump
  Freemem (P2,64);

Any suggestions?  Or is this combination asking for trouble
(in which case it would be good to mention this in the documentation)?


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