使用Visual Leak Detector库来检测CRT类型内存泄漏

要想使用VLD很简单,只要在代码前包含VLD.h,如下例:

#include "stdafx.h"
#include "vld.h"

int main(int argc, char* argv[])
{
 char* p=new char[100];
  *p='A';
  printf("Hello World!\n");
 return 0;
}

//记得添加VLD的include和lib目录到工程设定中。

Visual Leak Detector相关链接:

中文 http://www.cnblogs.com/shentao/archive/2011/10/07/2200525.html

英文 http://www.codeproject.com/KB/applications/visualleakdetector.aspx 

Known Bugs and Restrictions

已知的问题和限制

There are currently no known bugs in the latest release, but there are some known restrictions:

在最后的发行版本里暂时没有发现问题,但是有一些已知规则:

  • VLD does not detect COM leaks, out-of-process resource leaks, or any other types of memory leaks that are not associated with the CRT heap. In simpler terms, VLD only detects memory leaks that are the result of calls tonew or malloc. Keep in mind that VLD was created as an alternative to the built-in memory leak detector, which also only detects leaks fromnew and malloc.
  • VLD不能检测COM的泄露,进程外资源的泄露,或者和CRT堆无关联的其他类别的泄露。简单的说,VLD只能检测调用newmalloc而导致的内存泄漏。记住VLD是作为一种内建的内存泄漏检测工具而被设计出来的,所以它只能检测来自于newmalloc的泄露。
  • VLD is not compatible with version 6.5 of the Debug Help Library (dbghelp.dll). The recommended version ofdbghelp.dll to use with VLD is 6.3. Version 6.3 is included in the VLD distribution.
  • VLD和Debug Help Library (dbghelp.dll)库的6.5版本不兼容。配合VLD一起使用的dbghelp.dll的推荐版本是6.3。6.3已经被包含在VLD的发行包里。
  • The pre-compiled libraries included in the VLD distribution may not be compatible with Visual Studio 2005. If you need to use VLD with Visual Studio 2005,building VLD from source in Visual Studio 2005 should create compatible libraries.
  • 预编译好的VLD发行包可能和Visual Studio 2005不兼容。如果你需要在Visual Studio 2005里使用VLD,请在Visual Studio 2005通过VLD的源代码编译来得到兼容的库。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dj0379

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值