++的博客

你看不见我,你看不见我。。
随笔 - 22, 文章 - 0, 评论 - 2, 引用 - 0
数据加载中……

使用Windows Debug 工具来侦测堆崩溃

程序遇到运行时异常

Windows has triggered a breakpoint in MainD.exe. This may be due to a corruption of the heap, and indicates a bug in Agistment Utility.exe or any of the DLLs it has loaded. The output window may have more diagnostic information...

HEAP[MainD.exe]: HEAP: Free Heap block 15f05f8 modified at 15f0640 after it was freed


使用BoundsCheck 查不出任何问题,可能原因是:
1. 访问已经被释放的内存
2. 再次释放已经被释放过的内存

对于第2点,因为我自己使用SAFE_DELETE,基本不可能,google了很久,终于找到了一个MSMVP的建议.

下载Windows Debug 工具, http://www.microsoft.com/whdc/devtools/debugging/default.mspx
安装后,使用其中的gflags.exe工具打开PageHeap,
gflags -p /enable MainD.exe /full
重新使用VS用调试方式运行,很快就找到了出错位置,因为在某个静态函数中笔误导致

在编写稳定的服务器程序时,这个工具尤为有用

posted on 2008-03-27 15:33 Jerry.Wang 阅读(5973) 评论(0)  编辑 收藏 引用 所属分类: 开发