内​存​泄​露​调​试​之​ ​v​i​s​u​a​l​ ​l​e​a​k​ ​d​e​t​e​c​t​o​r​ ​工​具【转】

本文参考此文:http://kangzj.net/visual-leak-detector-download/
  另外一种检查内存泄露的工具:visual leak  detector  简称  vld         

1.首先要去下载vld并且安装  ,一个下载地址:http://www.brothers
oft.com/visual-leak-detector-download-288113.html        
2.安装 vld,我的安装目录为:D:Program FilesVisual Leak Detector
        
3. 在VS里面的 工具--选项--项目和解决方案--vc++目录  中添加相应的include和lib路径。
  我添加的路径如下:
         D:Program FilesVisual Leak Detectorinclude  添加到包含文件 选项。

  D:Program FilesVisual Leak DetectorlibWin32添加到库文件  选项。
        
4.在stdafx.h中增加:          #include"vld.h"
        
5.把D:Program FilesVisual Leak DetectorinWin32下面的两个DLL
 即 dbghelp.dll和vld.dll拷贝到 要调试的exe的目录,即Debug目录下。
6.调试启动,就可以在输出的窗口中发现内存泄露的同时,定位到是哪行代码出现问题啦。

原文地址:https://www.cnblogs.com/mazhenyu/p/3896316.html