参考:
http://www.codeproject.com/KB/applications/visualleakdetector.aspx
http://www.ltesting.net/AutoTest/Opentest/200609/896.htm
vld是一个windows下的免费的内存泄露检测工具,可以和vc配合使用,支持vc2005、vc2008,目前的版本是1.9h(beta)版(推荐使用这个版本)
在vista下使用vld的使用,总是出现错误无法正常工作,后来经过搜索,在http://www.codeproject.com/KB/applications/visualleakdetector.aspx
上的评论中找到了解决的方法:
评论“Solution for running 1.9 beta on Visual Studio 2008 with Vista ”给出了解决方法:
评论1:
VLD kept crashing when trying to use 1.9g beta on Windows Vista, visual studio 2008. I tried all the suggestions on here and nothing worked. But I finally figured it out.
when you make a project in visual C++ 2008, it sets some strange advanced Linker properties that cause VLD to crash:
I changed Linker->Advanced->Randomized Base Address from Enable Image Randomization (/DYNAMICBASE) to Disable Image Randomization (/DYNAMICBASE:NO)
Then I changed Linker->Advanced->Data Execution Prevention from Image is compatible with DEP (/NXCOMPAT) to Default
And now it works perfectly
Please let me know if this helped you! It'll make me feel better for spending a whole day trying to get it working!
-Nadav
评论2:
The base address randomization seems to be not necessary. Just disable DEP.
大致的意思是说,只需要禁用DEP即可,
在工程的“属性”->“链接器”->“高级”->数据执行保护(DEP),设为“默认”(default)或者“映像与 DEP 不兼容(/NXCOMPAT:NO) “ 即可