Visual Leak Detector not working with Unit Test in VS2012

981 Views Asked by At

I'm using the CppUnitTestFramework of Visual Studio 2012 for unit testing my c++ code. Now I want to check for memory leaks using Visual Leak Detector. So I put

#include "vld.h"

into my test class file. I add something like

new MyClass();

to a test method to "simulate" a memory leak.

Everything compiles and links fine which means the VLD directories are specified. But the test crashes:

------ Run test started ------
The active Test Run was aborted because the execution process exited unexpectedly. To investigate further, enable local crash dumps either at the machine level or for process vstest.executionengine.x86.exe. Go to more details: http://go.microsoft.com/fwlink/?linkid=232477
========== Run test finished: 0 run (0:00:02,3841194) ==========

When I remove the include directive the test passes successfully. Is there a way to enable VLD together with the Visual Studio test framework?

1

There are 1 best solutions below

1
On

I had a similar problem which was fixed by copying the Microsoft.DTfW.DHL.manifest in the vld bin directory to the unit test executable directory.