问题描述
我想知道是否有一个很好的方式来找到导致堆损坏错误的源代码,给定了在Visual Studio中写入分配的堆块外的数据的内存地址;
I wonder if there is a good way to find the source code that causes a heap corruption error, given the memory address of the data that was written 'outside' the allocated heap block in Visual Studio;
专用(0008)免费列表元素26F7F670是错误的大小(死)
Dedicated (0008) free list element 26F7F670 is wrong size (dead)
(尝试写下一些关于如何找到内存的注释错误)
(Trying to write down some notes on how to find memory errors)
提前感谢
推荐答案
开始安装windbg :
Begin with installing windbg:
然后打开这个页面:
gflags.exe –p /enable yourexecutable.exe /full
这将在每次堆分配后插入一个不可写的页面。
This will insert a non writable page after each heap allocation.
从windbg里面启动可执行文件后,堆外的任何写入现在被这个调试器抓住。以后再打开这个页面:
After this launch the executable from inside windbg, any writes outside the heap will now be caught by this debugger. To turn of the pageheap afterwards use this:
gflags.exe -p /disable yourexecutable.exe
有关如何使用pageheap的更多信息。
More info on how to use the pageheap here.
这篇关于Visual Studio - 如何查找堆损坏错误的源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!