Detecting C++ memory leaks in Visual Studio – again

I made a small post about detecting C++ memory leaks in Visual Studio in 2010. At the time that seemed to suffice, but some months ago someone told me about Visual Leak Detector and boy does it work.

According to the website itself

Visual Leak Detector is a free, robust, open-source memory leak detection system for Visual C++.

It’s pretty easy to use. After installing it, you just need to tell Visual C++ where to find the included header and library file.

Then it can be used with any C/C++ project simply by adding the following line to your code:

#include "vld.h"

It’s very easy to use and I tracked down a bunch of memory leaks hidden inside my code since the time I released Vizati.

As expected this is a heavy beast and debbuding while using VLD required much more memory, but totally worth it. You can even output to a file

7 Comments

  1. Sergey

    You can overload “new” operation, where you logged in all object creations. And check it after program completion. Do you try PVS studio? (http://www.viva64.com/) you can download and try it, very cool static code analyzer:) It’s can detect memory leaks and other.

  2. Pingback: Visual Leak Detector- Make It Useful To Detect Memory Leaks | Visual Leak Detector

  3. guido

    installed, put the include line…. Building Output: fatal error C1083: Cannot open include file: ‘vld.h’: No such file or directory

  4. vanitha

    I have added lib as well as include directories to my IDE. Its giving vld_x86.dll missing. But i have find that dll in bin

  5. Have you ever tried http://deleaker.com/ ? It is able to track GDI and handle leaks as well as memory leaks.

    PVS Studio mentioned above is good but it can’t find leaks, it can find developer mistakes, it is a static analyzer rather than runtime detector like VLD or Deleaker.

Leave a Reply