Memory Leak Detector

What is Memory Leak Detector?

Memory Leak Detector (MLD for short) is a very small library designed to help you find memory leaks in your program. MLD is designed to be used from C++ programs, and it is very lightweight, so it won't have significant impact on your program's performance.

Since library itself is written in standard C++ it should run with every reasonably fresh C++ compiler. It has been tested with GNU gcc on FreeBSD and Microsoft Visual C++ compiler on Windows XP, but it should run on every other operating system as well.

MLD is released under 4-clause BSD style licence, so you are pretty much free to use it for whatever you want. Make sure that you read section on using MLD to detect memory leaks before you download library source. If you face any problems using MLD you can share that with us in support center and we will give our best to help you.

What MLD can do?

MLD library is designed to be as simple and as fast as possible, but it is still pretty powerful tool. It can reliably detect all memory leaks that occured during execution of programs 'main' (or equivalent) function. Library will do its best to report you source line on which allocation without appropriate deallocation occured. For example:

1: int main() {
2:     char* x = new char[10];
3:     
4:     return 0;
5: }

It will display:

main.cpp(2)

Besides this MLD can detect inappropriate delete calls - meaning calling non-vector version of delete on vector of objects and viceversa. This is signaled with exception (because MLD can't get source location of operator delete calls).

What MLD can't do?

Please note that MLD is not code analyzing software (like for example Codenizer), so it works only when you are running your program, and because of that it can only check that one particular execution flow (the one your program is experiencing on that particular run) is free of memory leaks (or have memory leaks). Also note that MLD can not be used to prove that program doesn't have memory leaks, but it can be used to prove opposite (ie. that program does have them).

Read how to use MLD »