Mpatrol, a library, is designed for monitoring and managing dynamic memory allocations. Its prime purpose is to provide greater control and tracing of memory allocations within the system.
Mpatrol creates a comprehensive and configurable log of all dynamic memory operations that occurred during the lifetime of a program. Moreover, it checks for any misuse of dynamically allocated memory to ensure error-free code execution. By including a single header file at compile-time, you can integrate all of this functionality into existing code. On UNIX and Windows platforms, the mpatrol library doesn't require header file inclusion since it can be linked with existing object files at link-time or, in some environments, dynamically linked with existing programs at run-time.
To prevent mixing diagnostic output with the tested program's output, mpatrol directs all logging and tracing output to a separate log file. Furthermore, you can modify various library settings at run-time using an environment variable, eliminating the need to recompile or relink the library.
Mpatrol allows you to generate files that summarize memory allocation profiling statistics for each program. A profiling tool can read and display a set of tables based on this data. The profiling information includes size-based allocation summaries, function responsible for allocation, a call stack of the allocating function, and a list of memory leaks. It also includes a graph of all memory allocations listed in tabular form and a graph specification file for processing via the dot graph visualization package.
Creating a file containing a concise encoded trace of all memory allocations and deallocations performed by a program is also possible using mpatrol. A tracing tool can decode this file, display the events in tabular or graphical form, and calculate relevant statistics.
The mpatrol library is designed to replace calls to existing C and C++ memory allocation functions with minimal changes required. A preprocessor macro is included to facilitate conditional compilation for easy automation of release builds and debug builds.
Version 1.4.8: N/A