用过boundschecker的过来看看
bo96 2005-07-19 03:45:21 下了个boundschecker7.2,配vc2003,想试试传说中的这个工具是否好用.
安装后,将vc2003中BoundsChecker的选项选上,新建了个win32的控制台程序
#include <iostream>
using namespace std;
int main()
{
cout << "hello world" << endl;
return 0;
}
调试结果
BoundsChecker结果是Memory leaks Detected
Quantity:46 Total: 7,761 (即使将显示"hello world"那段去掉仍然是这两个数字)
问题1:这些内存泄漏的错误是哪里来的?怎么让他们消失?
在main中加上一段
char *p = new char[9999];
再调试变成了
Quantity:47 Total:17,796
细节中显示中多了条
Leak exiting program 1 10,035 BoundsCheckerTest.exe ! 0x000175B1 56
Memory Leak Exiting Program: Address 0x00DE2FD0 (10035) allocated by HeapAlloc.
这段内存泄漏是找着了,虽然大小不太符合.但也算发现了.可是下面那个框总是显示No source file
问题2:如何用BoundsChecker定位到源码中的泄漏位置.