C++ 的堆损坏检测工具
有没有工具可以帮助我检测 C++ 中的堆损坏?我无法提供源代码,因为这是一个大项目。我可以使用任何与 Visual Studio 或 xcode 配合使用的工具。该工具应该可以在多线程下正常工作。这个问题不是很常见,它会在很长一段时间后出现,并且只在非常特殊的情况下出现(它们没有被精确检测到!)。
谢谢你!
编辑:
谢谢大家的回答!我将测试这些工具,并在测试后接受一个答案。
Is there any tool to help me detect heap corruption in C++? I can't provide source code because it's a big project. I can use any tool that works with Visual Studio or with xcode. The tool should work fine with multithreading. The problem is not very common, it appears after a long time and only in very special cases(they were not detected precisely!).
Thank you!
EDIT:
Thanks you all for your answers! I will test the tools and I will accept one answer after the tests.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Valgrind 是用于对本机代码进行内存检测的事实上的工具。然而,它不能在 Windows 上运行(OS X 也可以)。
有一些商业工具可以在 Windows 上运行,虽然它们具有 GUI,但在我看来不如 Valgrind。
Valgrind is the defacto tool for doing memory instrumentation for native code. It, however, does not run on Windows (OS X is fine).
There are a few commercial tools which do run on Windows, and while they feature a GUI, are in my opinion inferior to Valgrind.
Windows 的调试工具包括gflags 和页堆 这有助于检测堆损坏。
The debugging tools for Windows include gflags and page heap which help detecting heap corruptions.
在 Mac OS X 上(我想这就是你所说的 Xcode 的意思),你已经有了一大堆内存调试工具,例如 http://developer.apple.com/library/mac/#releasenotes/DeveloperTools/RN-MallocOptions/index.html 让您通过环境变量打开堆检查。
On Mac OS X (which I presume is what you mean when you say Xcode), you have a whole bunch of memory debugging tools already, e.g. http://developer.apple.com/library/mac/#releasenotes/DeveloperTools/RN-MallocOptions/index.html which lets you turn on heap checking via environment variables.
在 Windows 上,使用应用程序验证程序
On Windows use Application Verifier