A light-weight yet powerful memory debugger

Accutrak

What is AccuTrak

AccuTrak is a highly configurable memory debug tool. It detects general memory errors, such as overrun, underrun, double delete, invalid access of freed memory as well as memory leaks, etc. It is light-weighted and easy to use. There is only one shared library and one configuration file to set up. The library may be preloaded into target process on platforms that support preloading, e.g. Linux and its variants. Therefore, no recompilation or linking is needed. One power feature of the tool is to pinpoint precisely a bug when it tries to access a memory out of its boundary. This is proved to be invaluable to investigate memory corruption issues. Anybody who ever works on such an issue can tell that memory corruption bug is very hard and illusive. A program usually fails much later and far away from the real bug. The code that eventually crashes the program is usually the victim of the original memory corruption and doesn't reveal any clue to the root cause.

 

AccuTrak intercepts memory allocation/de-allocation API calls and works its magic in one of the three modes according to user’s choice: hardware padding, software padding, and recording.

In the hardware padding mode (illustrated in the following graph), a system page (red block in the graph) is placed immediately in front or after the user space and is set inaccessible, hence the name dead page. If the buggy code ever reads or writes into the dead page, i.e. the memory is either overrun or underrun, a hardware exception occurs which points the user to the exact location of the offending code. When a piece of memory is freed by application, it may be rendered inaccessible as well so that access of free and double free errors can be caught the same way effectively. The software padding is somewhat similar. But instead of using inaccessible system page, it pads only a few bytes around the user space. Therefore, It is significantly faster than hardware padding with less system calls and memory overhead. But this method is less effective in catching memory corruption because the tool can only check the integrity of the memory blocks at the entry points of the memory API calls which may be too late. It is well suitable for detection of memory leak with back traces of the memory owners.

Download AccuTrak

The project is currently hosted on SourceForge. You could download binaries and source code, or leave your comments which is very much appreciated.

Licensing Info

The use and distribution of AccuTrak is governed by the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation.

Do you ever wonder what your program’s memory usage pattern looks like and how can you tune your memory manager to improve performance or reduce its memory consumption? The recording mode could help you. It logs all memory transactions (allocations and deallocations) in files as the program runs. The implementation is carefully designed to reduce runtime overhead. Once the program finishes the test, logged files are analyzed and a report is generated for statistics like size histogram, per-module usage, per-thread usage, etc. A user can also replay the logged files to simulate the memory request stream which doesn’t depend on the environment of a normal test, such as database connection, disk/network IO, etc. You can experiment with various memory management settings, or even switch to a different memory allocator.

 

AccuTrak is portable on most platforms. Currently, 64bit AIX PowerPC, Linux x86_64, HP-UX IA64 and Solaris sparcv9 are tested. More platform support are planned, for example Window 32bit and 64bit.