Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Leak Detector with Visual Studio 2017: no source code line numbers

I try to use Visual Leak Detector with Visual Studio 2017 with Platform Toolset "Visual Studio 2017" I have set the include directory and the library directory. Generating debug infos is on. Symbols for the exe are loaded.

(It works if i change the platform toolset to "Visual Studio 2013")

With Toolset "Visual Studio 2017" VLD is detecting leaks but do not resolve the line numbers:

Visual Leak Detector read settings from: C:\Program Files (x86)\Visual Leak Detector\vld.ini
Visual Leak Detector Version 2.5.1 installed.
WARNING: Visual Leak Detector detected memory leaks!
---------- Block 1 at 0x005ECDB8: 400 bytes ----------
  Leak Hash: 0x36672640, Count: 1, Total 400 bytes
  Call Stack (TID 6284):
    ucrtbased.dll!malloc()
    ConsoleApplication6.exe!0x00361FAD()
    ConsoleApplication6.exe!0x003618BC()
    ConsoleApplication6.exe!0x00361828()
    ConsoleApplication6.exe!0x00361883()
    ConsoleApplication6.exe!0x00361F7E()
    ConsoleApplication6.exe!0x00361DE0()
    ConsoleApplication6.exe!0x00361C7D()
    ConsoleApplication6.exe!0x00361F98()
    kernel32.dll!BaseThreadInitThunk() + 0x12 bytes
    ntdll.dll!RtlInitializeExceptionChain() + 0x63 bytes
    ntdll.dll!RtlInitializeExceptionChain() + 0x36 bytes

Maybe somebody know a way to enable line number resolution.

Thanks

like image 686
pulp Avatar asked Jun 22 '17 19:06

pulp


People also ask

How to detect memory leaks in Visual Studio?

To find memory leaks and inefficient memory usage, you can use tools such as the debugger-integrated Memory Usage diagnostic tool or tools in the Performance Profiler such as the . NET Object Allocation tool and the post-mortem Memory Usage tool.

Which is a free robust open source memory leak detection system for Visual Cpp?

Arkady ShapkinVisual Leak Detector is a free, robust, open-source memory leak detection system for Visual C++.

How to check for leaks in c++?

The primary tools for detecting memory leaks are the C/C++ debugger and the C Run-time Library (CRT) debug heap functions. The #define statement maps a base version of the CRT heap functions to the corresponding debug version. If you leave out the #define statement, the memory leak dump will be less detailed.


2 Answers

Try to disable partial PDB: in project properties click to Linker - All Options - Generate Debug Info, select "Generate Debug Information optimized for sharing and publishing (/DEBUG:FULL)" instead of default "Generate Debug Information for faster links".

like image 122
Artem Razin Avatar answered Oct 04 '22 03:10

Artem Razin


Just changing the linker settings to /DEBUG:FULL was not sufficient for me. Using /DEBUG:FASTLINK is ok.

However, I had to use a matching up-to-date dbghelp.dll from Visual Studio itself instead of the one coming with VLD (I am using VLD version 2.5.1 in x86 mode).

There are a few DLLs with that name. I took this one and copied it into my runtime folder of my project (replacing the one I had originally copied there from the VLD installation).

X:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\TestPlatform\Extensions\Cpp

Note: You might have to replace "Professional" with "Community" depending on the IDE version you have.

like image 29
Philip Allgaier Avatar answered Oct 04 '22 04:10

Philip Allgaier