Visual Leak Detector not reporting leaks
Asked Answered
A

1

14

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.

Atonic answered 12/2, 2014 at 7:14 Comment(5)
I've tried to use it as well and have suspicions about whether it can indeed pinpoint accurately and exhaustively memleaks or not :/Massa
Not true for VC++2010. Just tested and It detects leaks all right. Had to add includes and library in Properties->Additional Include (or Library) Directories.Shool
Is it maybe just that they haven't updated it for the new compiler yet?Atonic
Seems, that it doesn't work with VC++2013 (see Discussions at vld.codeplex.com/discussions/471214). Only for 2008/2010/2012.Shool
There's a new version that works for me: v2.4rc2Adjectival
M
7

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.

Mudslinger answered 6/11, 2014 at 13:7 Comment(1)
Now version 2.5 is available, it works up to 2015 version. It works for me.Breviary

© 2022 - 2024 — McMap. All rights reserved.