检测堆损坏
Visual Studio 2008 是否有任何选项(运行时)来立即检测堆损坏?
Does visual studio 2008 has any options (run time) to detect immedidate detection of heap corruption?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您查看调试例程 从 Visual C++ 调试运行时导出,您可以找到许多有用的调试函数,包括 _CrtSetDbgFlags 可用于设置调试堆检查自身是否损坏的频率。
If you look through the list of Debug Routines exported from the Visual C++ debug runtime, you can find many useful debugging functions, including _CrtSetDbgFlags that can be used to set how often the debug heap checks itself for corruption.
Microsoft 的应用程序验证器是实现此目的的绝佳工具。我发现它非常有用。下载它:
然后四处寻找一些教程。通常只需指向您的可执行文件,然后像往常一样在 Visual Studio 调试中运行您的 exe。它应该在问题发生的地方附近断裂。
Application Verifier from Microsoft is an excellent tool for this purpose. I've found it very useful. Download it :
And then look around for some tutorial. Usually just point to your executable, then run your exe in Visual Studio debug as always. It should break near where the issue occurs.
您可以使用应用程序的发布版本在任何 Windows 上(至少从 Windows 2000 起!)激活“整页堆”。
它将在错误发生时捕获 99% 的错误。
您可以查看此页面< /a> 有关此功能的教程。
完成应用程序故障排除后,不要忘记停用全页堆。
此技术可能不适用于调试版本,因为 CRT 的调试版本使用其自己的方案来分配动态内存。
You can activate the 'Full Page Heap' on any windows (since Windows 2000 at least !), with the release build of your application.
It will catch 99% of errors at the time they occur.
You can look at this page for an tutorial of this functionality.
Don't forget to deactivate full page heap when you are done troubleshooting your application.
This technique may not work on a debug build, since the debug version of the CRT uses its own scheme to allocate dynamic memory.