[fpc-pascal] heaptrc and high RAM usage

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Wed Mar 30 13:35:32 CEST 2016


I have an app that is using too much RAM and I am trying to figure out
which structures are using how much RAM.

Note that this is not a leak, everything is freed nicely when the app
closes, so I am resorting to putting DumpHeap() calls somewhere. The
app has multiple threads and is fairly large so it is not trivial to
guess who is responsible.

Using DumpHeap() I do get some results like this:

626944 memory blocks allocated : 17619122/20768760
626799 memory blocks freed     : 17602699/20752144
145 unfreed memory blocks : 16423
True heap size : 688128
True free heap : 639696
Should be : 641352
Call trace for block $0B019488 size 88
  $0048262C line 419 of <whatever unit>
  $0048246C line 394 of <whatever unit>
  $00485A7D line 1165 of <whatever unit>
  $0072FA33 line 2927 of <whatever unit>
  $007F65BE line 120 of <whatever unit>
  $0072FA33 line 2927 of <whatever unit>
  $007F65BE line 120 of <whatever unit>
Marker: global

But the information is so small. I have an excess of 100MB RAM usage
according to "task manager" in Windows 7, but heaptrc just shows a few
blocks like the one above and no mention of how many times this block
repeats itself ...it doesn't sum up 100MB, so I can't figure out how
much RAM each block is using. "size 88" isn't very helpful, if it uses
only 88 bytes it surely can't be the guilty one.

Any ideas if I should try something else instead of heaptrc? Or any
other ideas about what to do?

Felipe Monteiro de Carvalho

More information about the fpc-pascal mailing list