The mpatrol library is a powerful debugging tool that attempts to diagnose run-time errors that are caused by the wrong use of dynamically allocated memory. It acts as a malloc() debugger for debugging dynamic memory allocations, although it can also trace and profile calls to malloc() and free() too. If you don't know what the malloc() function or operator new[] do then this library is probably not for you. You have to have a certain amount of programming expertise and a knowledge of how to run a command line compiler and linker before you should attempt to use this.
Along with providing a comprehensive and configurable log of all dynamic memory operations that occurred during the lifetime of a program, the mpatrol library performs extensive checking to detect any misuse of dynamically allocated memory. All of this functionality can be integrated into existing code through the inclusion of a single header file at compile-time. On UNIX and Windows platforms (and AmigaOS when using GCC) this may not even be necessary as the mpatrol library can be linked with existing object files at link-time or, on some platforms, even dynamically linked with existing programs at run-time.
All logging and tracing output from the mpatrol library is sent to a separate log file in order to keep its diagnostics separate from any that the program being tested might generate. A wide variety of library settings can also be changed at run-time via an environment variable, thus removing the need to recompile or relink in order to change the library's behaviour.
A file containing a summary of the memory allocation profiling statistics for a particular program can be produced by the mpatrol library. This file can then be read by a profiling tool which will display a set of tables based upon the accumulated data. The profiling information includes summaries of all of the memory allocations listed by size and the function that allocated them and a list of memory leaks with the call stack of the allocating function. It also includes a graph of all memory allocations listed in tabular form, and an optional graph specification file for later processing by the dot graph visualisation package.
A file containing a concise encoded trace of all memory allocations and deallocations made by a program can also be produced by the mpatrol library. This file can then be read by a tracing tool which will decode the trace and display the events in tabular or graphical form, and also display any relevant statistics that could be calculated.
The mpatrol library has been designed with the intention of replacing calls to existing C and C++ memory allocation functions as seamlessly as possible, but in many cases that may not be possible and slight code modifications may be required. However, a preprocessor macro containing the version of the mpatrol library is provided for the purposes of conditional compilation so that release builds and debug builds can be easily automated.
The latest main distribution archive always contains an up to date edition of the mpatrol manual as unformatted TeXinfo documentation as well as in ASCII text, GNU Info, AmigaGuide and HTML formats, and the quick reference card as unformatted LaTeX documentation. It also contains the latest mpatrol manual and quick reference card in DVI, Postscript and PDF formats, as well as the latest UNIX manual pages for mpatrol in HTML, DVI, Postscript and PDF formats. Alternatively, you can browse the following online documentation or download the PDF versions of the mpatrol manual and quick reference card.
The mpatrol library is freely distributable software and is covered by the GNU Library General Public License. Only the source code and preformatted documentation for the library is available for download from this site; prebuilt binaries for specific platforms may be found at various other FTP sites.
A table summarising the platforms that the mpatrol library has been built on (and the major features that are supported on each platform) is shown below. Note that it should be fairly easy to build mpatrol on a UNIX system that is not listed below, but some work may be required to enable many of the advanced features that mpatrol might have support for on such a system. See the appendix on supported systems in the mpatrol manual for more details on what is supported on specific platforms.
Platform | Processor | Minimum Integration | Memory Access Handler | Stack Traversal | Symbol Reading | Thread Safe |
AIX 4.1 | RS/6000 | Link-time | Yes | Yes | Yes | No |
DG/UX 4.11, 4.20 | Pentium Pro, MC88100 | Run-time | Yes | Yes | Yes | Yes |
DRS/NX 6.2 | SPARC V7 | Link-time | Yes | Yes | Yes | No |
DYNIX/ptx 4.5 | Pentium Pro | Run-time | Yes | Yes | Yes | Yes |
FreeBSD 4.2 | Pentium II | Run-time | Yes | Yes | Yes | Yes |
HP/UX 10.20 | PA/RISC 9000 | Link-time | Yes | Yes | Yes | No |
IRIX 5.3 | R4000 | Run-time | Yes | Yes | Yes | No |
Red Hat Linux 5.1, 6.0, 6.1, 6.2, 7.0, 7.1 | Pentium III, MC68040 | Run-time | Yes | Yes | Yes | Yes |
SuSE Linux 7.1 | Pentium II | Run-time | Yes | Yes | Yes | Yes |
LynxOS 3.0.0 | Pentium Pro, PowerPC | Link-time | Yes | Yes | Limited | Yes |
SINIX 5.43 | R4000 | Link-time | Yes | Yes | Yes | No |
Solaris 2.5, 2.6, 7, 8 | Pentium Pro, SPARC V8/V9 | Run-time | Yes | Yes | Yes | Yes |
Tru64 5.0 | Alpha | Run-time | Yes | Yes | Yes | No |
UnixWare 7.1.1 | Pentium II | Link-time | Yes | Yes | Yes | No |
AmigaOS 3.1 | MC68040 | Link-time | No | Limited | Limited | Yes |
Windows NT 4.0 | Pentium III | Link-time | Yes | Yes | Yes | Yes |
The latest version of mpatrol can be downloaded from here, as well as older releases. However, due to space considerations, only selected older releases will be made available for download. All downloadable files are in gzipped tar archive format.
Several people have contributed code to mpatrol and some of that code has not yet made it into the mpatrol distribution. They are available here as patches that can be applied to the latest mpatrol distribution, but they are normally only useful for specific situations and are untested.
Go back to my home page | Web access statistics by Nedstat |