This is a set of tools designed to help find memory leaks in programs, and to locate memory-hogging functions. It's implemented as a wrapper library that goes around malloc/free/etc, and an include file that "intercepts" calls to malloc/free/etc and makes them call the wrappers. Thus, you can get extensive memory profiling and leak detection by just adding one #include directive at the top of your file and recompiling/linking. Unlike some similar tools I've seen in the past, this makes sure that it keeps its on-disk data current, so that if the program is crashed or interrupted, the results still have some validity. The on-disk data is as compacted as I could make it, to give a chance of this being useable in debugging big memory pigs. It adds some cost in performance and memory size (since it keeps its own in-memory symbol tables) but since it's only a debugging tool, I think the cost is worth the benefit. This library can also be used to track only allocations in a single module, or set of modules, and doesn't interfere with calls to the "real" malloc() that are made in other library routines. Every effort has been made to ensure that the code is portable and won't interfere with running code - it should just plug in or out. The biggest hindrances are forward declarations of malloc() [which the preprocessor gleefully turns into syntax errors for you] and structure elements named "free". The code has been tested under Ultrix on DEC Risc and VAX systems, and under SunOS on a Motorola platform. Please send patches, suggestions, etc, to the author, who will probably not have time to do anything with them. Compiling and building: You may wish to edit the Makefile and glance at mnemconf.h, then simply type "make". "make mtest" will build a simple test program that will give you an idea of how things work. "make runmtest" will run the test and do analysis on it. Marcus J. Ranum mjr@decuac.dec.com