[fpc-pascal] 2x HeapTrc: output with -gl on ppcx64; QuickTrace/KeepReleased bug?

Tom Verhoeff T.Verhoeff at tue.nl
Fri Dec 14 12:15:27 CET 2007


We use the HeapTrc facility in our education to get an impression of
memory management issues in programs submitted for assignments.

Typically our Peach.win.tue.nl system runs programs to test functionality
and robustness (i.e. test for proper precondition checking through Assert)
on small and bigger cases.  Memory management is tested only with one
or two small cases.

I was surprised to find out that the output depends on the platform.
We use FPC 2.2.0 on Linux.

With ppc386 -gl you get something like:

... (line with full path suppressed) ...
Heap dump by heaptrc unit
183 memory blocks allocated : 4419/5400
175 memory blocks freed     : 4355/5336
8 unfreed memory blocks : 64
True heap size : 425984
True free heap : 425344
Should be : 425472
Call trace for block $F7F863C8 size 8
  $08064540  TQUEUEOFINT__PUT,  line 153 of Queue_Pointers.pas
  $08048FCD  TESTPUT,  line 234 of unbounded_queue_pointers.pp
  $080494A5  TESTMULTIPUT,  line 290 of unbounded_queue_pointers.pp
  $0804953C  TESTSAW,  line 314 of unbounded_queue_pointers.pp
  $08049C94  PROCESSINFILE,  line 431 of unbounded_queue_pointers.pp
  $08049FC0  main,  line 459 of unbounded_queue_pointers.pp
  $0807C621
... etc. ...

With ppcx64 -gl (all options equal, also in config files) it produces:

... (line with full path suppressed) ...
Heap dump by heaptrc unit
183 memory blocks allocated : 6319/7304
175 memory blocks freed     : 6191/7176
8 unfreed memory blocks : 128
True heap size : 393216
True free heap : 391936
Should be : 392192
Call trace for block $00002AD11627F780 size 16
  $0000000000425DC5
  $000000000040173B line 235 of unbounded_queue_pointers.pp
  $0000000000401E05 line 289 of unbounded_queue_pointers.pp
  $0000000000401EAC line 312 of unbounded_queue_pointers.pp
  $00000000004029A4 line 431 of unbounded_queue_pointers.pp
  $0000000000402DDA line 461 of unbounded_queue_pointers.pp
  $00000000004001B8
... etc. ...

The difference is that under ppcx64 no proc/func names are listed,
and some entries have no file name/line number at all (though they do
under ppc386).  Furthermore, the line numbers are reported differently.
It is exactly the same program running the same test case.

This makes it harder to interpret the feedback (especially for beginners).

A second issue I encountered with HeapTrc is that setting

QuickTrace := False { default is True }
KeepReleased := True { default is False }

will produce a heap trace report that contains many of these lines:

error in linked list of heap_mem_info

Any idea whether this is a bug, or just the fact that the combination
of settings above should not be used.  Either of

QuickTrace := True { default }
KeepReleased := True

and

QuickTrace := False
KeepReleased := False { default }

does not produce these error lines.

This second problem also appears on FPC 2.0.4 under Mac OS X.

Thanks for any feedback,

	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-pascal mailing list