Memory management bugs, in particular incorrect uses of free, are notoriously hard to debug because the symptoms of the problem show up in a place far disconnected from where the bug actually occurred. For instance, an incorrect free can lead to corruption of a completely unrelated object allocated later.
HeapSafe is a C compiler and runtime library that directly check that a program uses free safely, with time and space overheads low enough (normally below 30%) that it can be used all the time. Furthermore, when HeapSafe does detect an invalid free, it can simply leak the object (and log the problem), preventing the program from failing.
HeapSafe is available in the following formats:
There are two separate tarballs because of incompatible licenses in some platform-specific code in HeapSafe's runtime library. Except for the library differences, the two tarballs are identical.
You will need to install OCaml to compile HeapSafe (typically available as the ocaml package).
Some examples of C programs converted to HeapSafe can be found in heapsafe-examples-1.0.tar.gz.
More information on HeapSafe can be found at http://memory.intel-research.net.