vld(Visual Leak Detector) 内存泄露检测工具,Visual C++ 2008-2015, vs 2010,vs 2008,vs 2012,vs 2015

原文: https://vld.codeplex.com/

Visual Leak Detector 是一款专用于Visual C++的内存泄漏检测工具,它免费,开源,且鲁棒性高。

VLD很容易使用:

1. 安装完vld后,只要告诉Visual C++哪里去找到它的头文件和库。(下载地址:https://vld.codeplex.com

2. 然后您只要在你的c/c++工程中加上下面这一行代码,就可以使用vld了:
#include <vld.h> 

您的工程在Visual Studio debug模式下运行,运行结束后,Visual Leak Detector会将内存泄漏的报告打印出来。内存泄漏报告包含完整的调用堆栈,没释放的内存大小。双击其中的调用行,可以跳转到对应的代码行上。

这种方式能够高效得帮您快速诊断,修复内存泄漏问题。

CRT Debug库和VLD主要的不同之处在于:Visual Leak Detector 完整的展示了内存泄漏的调用堆栈。

下面就是一个VLD打印的内存泄漏报告例子:

---------- Block 1199 at 0x04BE1058: 136 bytes ----------
Call Stack:
d:FoobarFooLog.cpp (26): FooLog::getInstance
d:FoobarFooMain.cpp (75): FooMain::init
f:ddvctoolscrt_bldself_x86crtsrccrtexe.c (578): __tmainCRTStartup
f:ddvctoolscrt_bldself_x86crtsrccrtexe.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                                   ........ ........

This software is provided "AS IS" without warranty of any kind.

The project was originally developed by Dan Moulding, but they are no longer supported. Features of version 2.0 are implemented by Arkadiy Shapkin (me).

Links

 

Last edited Jan 10 at 5:30 AM by KindDragon, version 22

原文地址:https://www.cnblogs.com/snailgardening/p/vld.html