admin管理员组文章数量:1593939
下载地址【https://kinddragon.github.io/vld/】
Visual Leak Detector
Visual Leak Detector (VLD) is an open-source alternative to investigate these memory leaks. Using it is very simple and straightforward:
Download and install VLD. The installer will prompt about adding its bin path (C:…\Visual Leak Detector\bin) to the PATH environment variable. Accept it or add it manually yourself. Either way, you will need to log out and log back in for the addition to the PATH to take effect. vld.dll and dbghelp.dll, from the bin directory need to be available on the system path.
Make sure the Visual C++ project is in Debug mode.
Add the VLD include path (C:…\Visual Leak Detector\include) to the Include Directories of the project.
Add the VLD lib path (C:…\Visual Leak Detector\lib) to the Additional Library Directories of the project.
Add #include <vld.h> to any of the C++ source files in the project. This header will bring in vld.lib during the linking stage.
Rebuild the project and execute the compiled program in Debug mode. On program exit, VLD will print out the memory leak information it detected in the Output window.
The memory leak information printed by VLD looks like this:
---------- Block 1199 at 0x04BE1058: 136 bytes ----------
Call Stack:
d:\Foobar\FooLog.cpp (26): FooLog::getInstance
d:\Foobar\FooMain.cpp (75): FooMain::init
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (578): __tmainCRTStartup
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (403): WinMainCRTStartup
0x759A3677 (File and line number not available): BaseThreadInitThunk
0x770C9D42 (File and line number not available): RtlInitializeExceptionChain
0x770C9D15 (File and line number not available): RtlInitializeExceptionChain
Data:
9C 33 2D 6B 74 2A 2D 6B C8 11 BE 04 00 00 00 00 .3-kt*-k ........
00 00 00 00 70 14 BB 6C 70 14 BB 6C 00 00 00 00 ....p..l p..l....
00 00 00 00 68 14 BB 6C 68 14 BB 6C 00 00 00 00 ....h..l h..l....
00 00 00 00 6C 14 BB 6C 6C 14 BB 6C 20 12 BE 04 ....l..l l..l....
00 00 00 00 CD 00 CD CD 00 00 00 00 01 CD CD CD ........ ........
68 14 BB 6C 78 33 2D 6B 00 00 00 00 00 00 00 00 h..lx3-k ........
00 00 00 00 01 02 00 00 06 00 00 00 00 00 00 00 ........ ........
00 00 00 00 00 00 00 00 88 11 BE 04 5C 10 BE 04 ........ ....\...
00 00 00 00 20 CD CD CD ........ ........
转载自【https://codeyarns/tech/2010-09-11-visual-leak-detector-investigate-memory-leaks-in-visual-c.html】
本文标签: DetectorleakVisualLeaksMemory
版权声明:本文标题:[转载]Visual Leak Detector: Investigate Memory Leaks in Visual C++ 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dianzi/1728178702a1148177.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论