Visual Leak Detector does not work

6.5k Views Asked by At

I have just started using Visual Leak Detector for Visual C++ 2008/2010

When i run it on small app (just few line with undeleted allocations) it works just fine.

Now I want to run it into my bigger app (wxWidgets app, 2 threads), but when I include

#include <vld.h>

my app does not completely start up. It starts cycling when Gui is created. Somethimes app load completely, but again, stuck when I for example press some button...

When I hit pause button, to see which code is being processed I see just

stack: ntdll, kernel...

Is anybody run into similar problem?

Is there any way to make it work?

2

There are 2 best solutions below

0
On BEST ANSWER

Visual Leak Detector makes the App run VERY slowly, be patient.

Are you running a single binary file?

I'v had issues when my program was split into the main executable and libraries loaded on the run.

The solution was to do the #include everywhere, especially the executable.

Note that you can use VLDDisable and VLDEnable if you want to target specific parts of the code, note that these work per thread. Disabling in one thread doesn't modify what goes on in others.

0
On

This is not exactly an answer to this specific question, but it fixed my problem and I wanted to document it somewhere somebody else may be able to find it helpful to them.

I was linking a program with vld and got

fatal error LNK1120: 1 unresolved externals
error LNK2001: unresolved external symbol "__declspec(dllimport) class     VisualLeakDetector vld" (__imp_?vld@@3VVisualLeakDetector@@A)

I did a dumpbin of vld.lib and noticed that it has an external called

      F26 __imp_?g_vld@@3VVisualLeakDetector@@A

notice the "g_"

So changed my vld.h from

#pragma comment(linker, "/include:__imp_?vld@@3VVisualLeakDetector@@A")
to
#pragma comment(linker, "/include:__imp_?g_vld@@3VVisualLeakDetector@@A")

and then it linked and worked just fine.

again, hopefully google will be able to find this answer for people having vld linking problems.