Visual Leak Detector 2.2 有人用过吗,求教,该怎么处理
Visual Leak Detector 2.2 有人用过吗,求教
Visual Leak Detector 2.2
我的IDE是VS2008
环境我都配好后,使用如下代码
#include <vld.h>
#include <stdlib.h>
#include <stdio.h>
void f()
{
int *p = new int(0x12345678);
p = new int(0x12345678);
printf("p=%08x", p);
}
void main()
{
f();
getchar();
}
Visual Leak Detector给出的信息如下:
Visual Leak Detector Version 2.2 installed.
WARNING: Visual Leak Detector detected memory leaks!
---------- Block 1 at 0x00575E70: 4 bytes ----------
Call Stack:
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (586): test_mem.exe!__tmainCRTStartup + 0x19 bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (403): test_mem.exe!mainCRTStartup
0x7C817077 (File and line number not available): kernel32.dll!RegisterWaitForInputIdle + 0x49 bytes
Data:
78 56 34 12 xV4..... ........
---------- Block 2 at 0x00575EB0: 4 bytes ----------
Call Stack:
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (586): test_mem.exe!__tmainCRTStartup + 0x19 bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (403): test_mem.exe!mainCRTStartup
0x7C817077 (File and line number not available): kernel32.dll!RegisterWaitForInputIdle + 0x49 bytes
Data:
78 56 34 12 xV4..... ........
Visual Leak Detector detected 2 memory leaks (80 bytes).
Largest number used: 80 bytes.
Total allocations: 80 bytes.
Visual Leak Detector is now exiting.
给出的内存泄露没有指定到程序的文件中,为什么会出现这种情况?
------解决方案--------------------
工具哪有人的大脑那么智能
你可以用BoundChecker
------解决方案--------------------
请问你的信息输出在哪个窗口?是即时窗口,还是输出窗口?
------解决方案--------------------
Visual Leak Detector(VLD)是一款用于Visual C++的免费的内存泄露检测工具,用户可从http://www.codeproject.com/tools /visualleakdetector.asp下载,该软件以库形式与用户的被测工程一起使用,由于VLD是按LGPL(GNU LESSER GENERAL PUBLIC LICENSE)协议对外开源,所以使用VLD是安全的,不必担心版权问题。
使用VLD:先从网站下载VLD的 zip包,当前最高版本是V1.0,解压后得到vld.h、 vldapi.h、vld.lib、vldmt.lib、vldmtdll.lib、dbghelp.dll等文件,把这些所有.h头文件拷贝到VC默认的include目录下,将所有.lib文件拷贝到VC默认的lib目录下,安装工作就完成了。
使用VLD很简单,只须在包含入口函数的CPP或 C文件中把vld.h头文件包含进来即可。该include语句要求放在最前面,如果当前工程定义预编译head文件(如stdafx.h),则放在 “#include <stdafx.h>”语句之后就可以了。
这是我博客里自己总结的,试验过了,可以准确定位,你看好步骤,自己是否步骤出了问题
------解决方案--------------------
windbg
Visual Leak Detector 2.2
我的IDE是VS2008
环境我都配好后,使用如下代码
#include <vld.h>
#include <stdlib.h>
#include <stdio.h>
void f()
{
int *p = new int(0x12345678);
p = new int(0x12345678);
printf("p=%08x", p);
}
void main()
{
f();
getchar();
}
Visual Leak Detector给出的信息如下:
Visual Leak Detector Version 2.2 installed.
WARNING: Visual Leak Detector detected memory leaks!
---------- Block 1 at 0x00575E70: 4 bytes ----------
Call Stack:
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (586): test_mem.exe!__tmainCRTStartup + 0x19 bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (403): test_mem.exe!mainCRTStartup
0x7C817077 (File and line number not available): kernel32.dll!RegisterWaitForInputIdle + 0x49 bytes
Data:
78 56 34 12 xV4..... ........
---------- Block 2 at 0x00575EB0: 4 bytes ----------
Call Stack:
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (586): test_mem.exe!__tmainCRTStartup + 0x19 bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (403): test_mem.exe!mainCRTStartup
0x7C817077 (File and line number not available): kernel32.dll!RegisterWaitForInputIdle + 0x49 bytes
Data:
78 56 34 12 xV4..... ........
Visual Leak Detector detected 2 memory leaks (80 bytes).
Largest number used: 80 bytes.
Total allocations: 80 bytes.
Visual Leak Detector is now exiting.
给出的内存泄露没有指定到程序的文件中,为什么会出现这种情况?
------解决方案--------------------
工具哪有人的大脑那么智能
你可以用BoundChecker
------解决方案--------------------
请问你的信息输出在哪个窗口?是即时窗口,还是输出窗口?
------解决方案--------------------
Visual Leak Detector(VLD)是一款用于Visual C++的免费的内存泄露检测工具,用户可从http://www.codeproject.com/tools /visualleakdetector.asp下载,该软件以库形式与用户的被测工程一起使用,由于VLD是按LGPL(GNU LESSER GENERAL PUBLIC LICENSE)协议对外开源,所以使用VLD是安全的,不必担心版权问题。
使用VLD:先从网站下载VLD的 zip包,当前最高版本是V1.0,解压后得到vld.h、 vldapi.h、vld.lib、vldmt.lib、vldmtdll.lib、dbghelp.dll等文件,把这些所有.h头文件拷贝到VC默认的include目录下,将所有.lib文件拷贝到VC默认的lib目录下,安装工作就完成了。
使用VLD很简单,只须在包含入口函数的CPP或 C文件中把vld.h头文件包含进来即可。该include语句要求放在最前面,如果当前工程定义预编译head文件(如stdafx.h),则放在 “#include <stdafx.h>”语句之后就可以了。
这是我博客里自己总结的,试验过了,可以准确定位,你看好步骤,自己是否步骤出了问题
------解决方案--------------------
windbg