Visual Leak Detector not reporting leaks

Kittenmittons picture Kittenmittons · Feb 12, 2014 · Viewed 9.4k times · Source

I am a bit new to using Visual Studio 2013 and am trying to get Visual Leak Detector (Version 2.3) working so that I can check my projects for memory leaks.

I've got it installed and have added C:\Program Files (x86)\Visual Leak Detector\include to my include directories

and C:\Program Files (x86)\Visual Leak Detector\lib\Win32 to my library directories (both for debug mode).

I build and run the following simple program using the debug menu (or hitting f5):

#include <iostream>
#include <vld.h> //visual leak detector

using namespace std;

int main()
{
for (int i = 0; i < 1000000; i++)
     int *ptr = new int(100);

return 0;
}

The leak is obvious (and intentional) here, to test the functionality, but this is the report I get back:

Visual Leak Detector Version 2.3 installed.
The thread 0x38ac has exited with code 0 (0x0).
No memory leaks detected.
Visual Leak Detector is now exiting.
The program '[8136] Test.exe' has exited with code 0 (0x0).

Any ideas?

Edit: I should point out that adding

#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>

To the beginning of my code and

_CrtDumpMemoryLeaks();

right before the end of main(), does in fact cause Visual Studio's built in leak detection to report leaks, however Visual leak detector still follows this report by saying No memory leaks detected and providing no information.

Answer

Dragoon picture Dragoon · Nov 6, 2014

It looks like to be a bug with VC++2013, it does work when I use the VC++2010 compiler.

Although I can imagine this not being an option for you. If it helps you, you could use the latest beta version v2.4rc2.