Debugging Memory Leaks with Heapmon
Need more information here about when heapmon is an appropriate tool. Usually valgrind is a better tool, but heapmon can handle cases where the program doesn't shut down cleanly.
Obtaining Heapmon
Obtain the most recent (top) "snapshot" from the following page:
http://www.bonsai.com/ken/git/?p=heapmon.git;a=summary
Building Heapmon
Unpack the distribution on a linux machine and build w/ make.
Running Heapmon
These instructions are a little out of date. Now the control file has a pid in the name so that forking programs can be handled. Likewise the resulting log ...
Preload the heapmon.so on the execution line of the program
LD_PRELOAD=/absolute/path/to/heapmon.so foobar
Let the program get to the spot where you want to "mark" the heap.
Touch the control file
touch heapmon.ctl
Let the program run over the desired period.
Touch the control file again
touch heapmon.ctl
Evaluate heapmon.log