This project has moved and is read-only. For the latest updates, please go here.

VS2008 vs VS2010 and no memory leaks detected

Nov 3, 2010 at 5:50 PM

Folks,

I've been using VLD for years (the original version) and recently I've migrated to VS2010.

I have tried very simple program to check my new installation:

 

#include <vld.h>
#include <cstdlib>
int main()
{
    char* p = (char*)std::malloc(10);
    return 0;
}

 

Under Visual Studio 2008, the obvious leak is being detected:

 

---------- Block 0 at 0x016C5D98: 10 bytes ----------
  Call Stack:
    g:\workshop\testcpp\testcpp2008\testcpp2008.cpp (6): main
    f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (586): __tmainCRTStartup
    f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (403): mainCRTStartup
    0x7654ECCB (File and line number not available): BaseThreadInitThunk
    0x76FBD24D (File and line number not available): RtlCreateUserProcess
    0x76FBD45F (File and line number not available): RtlCreateProcessParameters
  Data:
    CD CD CD CD    CD CD CD CD    CD CD                          ........ ........
Visual Leak Detector detected 1 memory leak.

 

 

However, under Visual Studio 2010 nothing is detected:

 

No memory leaks detected.
Visual Leak Detector is now exiting.

 

In both cases, I have tried Debug builds certainly.

I have tried both VLD versions, old 1.9h from Dan Moulding's page and the new 2.0b from vld.codeplex.com. In all cases I use default configuration, no custom changes applied.

Am I doing any silly mistake here?

Jan 18, 2011 at 9:12 AM

Maybe you can try malloc instead of std::malloc.

I meet similar problem.  I use some APIs which internally call malloc to allocate memory, and require the caller to release the memory. These APIs are exposed by the 3rd DLL, my DLL just links it.  Run my add-in DLL in the program, vld can't detect the memory leak.

But I use malloc directly in my code, vld can detect the memory leak in this case.  I suspect that vld only can detect the memory leak from the DLL which "binds" the vld, leaks on other DLLs are not detected.