heaptrc

From Free Pascal wiki
Revision as of 18:01, 22 April 2014 by Jwdietrich (talk | contribs) (Screenshot added.)
Jump to navigationJump to search

heaptrc is a unit that can be used to debug allocation and deallocation of memory blocks. It keeps track of calls to getmem/freemem, and, implicitly, of New/Dispose statements.

When a program using heaptrc ends, heaptrc can write out the total memory used and a list of allocated but not freed blocks to a file. When run in the console (*nix or Windows), heaptrc will print this output to screen unless otherwise instructed. In Lazarus GUI programs on Windows, the output will appear in numerous small dialog boxes, which may be very unpractical.


Standard output of heaptrc on Windows (despite of the title there is no error in the application)


On *nix (including BSD, Linux and Mac OS X), by default, nothing will be shown for GUI programs. See leakview for details on how to make use of heaptrc effectively.

See also