Plumber
by Owen O'Malley
Purpose
Developing large systems based on many levels of abstraction and
ADT's has lead to programs that utilize large amounts of virtual
memory and swap space. Without tool support, the only method for
finding the source of memory leaks is code inspections. I wrote
Plumber to help us identify the memory leaks in our software. It has
been applied to several of the
Arcadia tools, such as Chimera, Chiron and ProDAG (and indirectly
to Pleiades and Q). Plumber was designed to be used with Ada with or
without C, but could be used with only C.
Plumber keeps additional bookkeeping information with each block of
memory that is allocated using NEW in Ada or
malloc/realloc/calloc/memalign in C. When the block is freed via
UNCHECKED_DEALLOCATION in Ada or free in C, its information is removed
from the list. At program termination any unfreed blocks are reported
in a log file along with the call stack from when they were created
via NEW or malloc.
Plumber only requires relinking the application with a new library.
The code will run slower than normal, but when the program
terminates it will produce a log file with a list of all the unfreed
blocks of memory and where they were created with NEW.
Platform
Plumber has only been tested on SunAda 1.1, but probably works on any
version of SunAda. You also need gcc to compile the stack walking
code. Porting Plumber to another compiler would depend on
being able to replace NEW and UNCHECKED_DEALLOCATION. Porting to
another architecture would require rewriting the stack walking code
and possibly the symbol table translation.
Availability
Plumber is copy-righted by the University of California, but source
code is available free of charge via
WWW.
If you have any questions, please contact me by email.
Top: Owen O'Malley