HOWTO compile and use the mpatrol memory leak detection library

1. Download the latest MinGW automated Installer from:

2. Run it, select Download latest repository catalogues, then select all components to be installed (you need C and C++ compilers, if you want you can leave out the other three - Fortran, ObjC, Ada)

3. Once MinGW is installed download the autotooled mpatrol version (we have it thanks to Vincent Torri) either from the SVN repository via an SVN client:
or using your web browser from:
click *Download GNU tarball* at the bottom

4. Extract the files to some temporary folder

5. Run Start Menu >> Programs >> MinGW >> MinGW Shell

6. Navigate to your temporary folder using the "cd" command

7. Run

$ autoreconf -f -i 

8. If you do not have the pkg-config program installed (and this is the case if you installed a fresh MinGW installation), download this file
and copy pkg.m4 from share\local (after the extraction of course) to

This doesn't install the pkg-config program, it's just a necessity so that the configure script doesn't crash.
If you want to install and use the pkg-config utility check out this tutorial:
you’re interested mostly in this line:
> Untar glib 2.26.1, pkg-config 0.25 and intl 0.18 in /usr/local, and pkg-config 0.25 dev (for pkg.m4) in C:\MinGW

7. Run

$ ./configure 

8. Run

$ make 

9. Run

$ make install 

10. You're done. Navigate to directory tests in your temporary folder, then to the subdirectory fail and compile the test program using this command

$ gcc -I/usr/local/include/mpatrol-1 test1.c -o test1 -L/usr/local/lib -lmpatrol -lbfd -liberty -limagehlp -lintl 

Run the output using

$ ./test1 

You should get a valid mpatrol.log. To find out what a valid log is check out the mpatrol documentation
I recommend compiling some more test programs. Instead of environment variables in Windows you can use the export command. Type this before executing the test program


To use multiple different options simply divide them by a space character


11. Now you're ready to explore the underworld of memory leaks ;)

This wiki is not a forum for discussion of usage issues. Please use the list instead. We do not allow creation of comments by anonymous or untrusted users, on any page.
Site Status

Site maintenance performed successfully, site online Dec 13th 12:00 AM Eastern.