Usage of VIsual Memory Leak Detector

Posted by Yan Cheng CHEOK on Stack Overflow See other posts from Stack Overflow or by Yan Cheng CHEOK
Published on 2010-04-01T08:21:01Z Indexed on 2010/04/01 8:23 UTC
Read the original article Hit count: 232

I found a very interesting memory leak detector by using Visual C++.

http://www.codeproject.com/KB/applications/visualleakdetector.aspx

I try it out, but cannot make it works to detect a memory leak code.

I am using MS Visual Studio 2008. Any step I had missed out?

#include "stdafx.h"
#include "vld.h"
#include <iostream>

void fun() {
    new int[1000];
}

int _tmain(int argc, _TCHAR* argv[])
{
    fun();
    std::cout << "lead?" << std::endl;
    getchar();
    return 0;
}

The output when I run in debug mode is :

...
...
'Test.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989\msvcr80.dll', Symbols loaded.
'Test.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', Symbols loaded (source information stripped).
'Test.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_f863c71f\msvcp90d.dll', Symbols loaded.
'Test.exe': Loaded 'C:\Program Files\Visual Leak Detector\bin\dbghelp.dll', Symbols loaded (source information stripped).
Visual Leak Detector Version 1.9d installed.
No memory leaks detected.
Visual Leak Detector is now exiting.
The program '[5468] Test.exe: Native' has exited with code 0 (0x0).

© Stack Overflow or respective owner

Related posts about memory-leaks

Related posts about visual-studio-2008