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:
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
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.
installed, put the include line…. Building Output: fatal error C1083: Cannot open include file: ‘vld.h’: No such file or directory
You need to add both VLD include and libs folder to your IDE paths in order to build
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
It seems the installer only add the win64 path to vld to your System Paths.
Try adding the 32bits path too in Environment variables.
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.