We have a prototype implementation of a tool to do memory checking. It
works by keeping track of the typestate of each byte of memory in the
heap and the stack. The typestate can be one of Undefined, Uninitialized,
Free or Set. The program can detect invalid transitions (i.e. attempting
to set or use undefined or free storage or attempting to access
uninitialized storage). In addition, the program keeps track of heap
management through malloc and free and at the end of the run will report
all memory blocks that were not freed and that are not accessible (i.e.
The tools works using a spliced-in shared library. This has the advantage
that no special compilation or linking needs to be done to the application.
It has the disadvantage that it requires the application to be compiled
with shared libraries (at least libc) and to use the standard version of
malloc and free. It has been tested with C and C++ programs, but should
also work with Pascal, etc.
The tool is available for ftp in source form only from wilma.cs.brown.edu
It requires C++ 3.0.1 and SunOS 4.X to build. (We use AT&T C++, it might
need some minor manipulations to use with other C++ compilers; it will not
work completely with the Solaris compilers (even on 4.X) -- eventually this
will be fixed.) Installation may be non-trivial so be warned.