MemProf is a tool for profiling memory usage and finding memory leaks. Its two major features are:
- It can generate a profile how much memory was allocated by each function in your program.
- It can scan memory and find blocks that you've allocated but are no longer referenced anywhere.
MemProf works by pre-loading a library to override the C library's memory allocation functions and does not require you to recompile your program.
One advantage MemProf has over some other similar tools that are available is that it has a nice GUI frontend and is relatively easy to use.
Getting in Touch
Frequently asked questions
What do the colors mean?
- Yellow = Allocated
- Blue = Allocated then freed (high-water-mark)
- Red = Leaked (after you press the "Leaks" toolbar button)
Is there any documentation?
Not currently, no. Contributions would be appreciated.
Other Similar Tools
The technique that MemProf uses for detecting leaks, scanning memory for pointers, is the basis of the Boehm Garbage Collector. While the Boehm GC is mostly meant for memory management, it also has a mode for leak detection in programs that manually free memory. The package, unlike MemProf, is highly portable.
Keith Packard wrote a memory debugging library (memleak) included with X that does leak detection. This was separated out from the X distribution by Jon Christopher and turned into the standalone Debauch package. From the documentation Debauch seems similar to MemProf in scope and techniques but somewhat more comprehensive and portable. It doesn't, however, have MemProf's nice GUI frontend.