什么是 C/C++ 程序及其插件 DLL 的最佳空闲内存泄漏检测器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25730/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the best free memory leak detector for a C/C++ program and its plug-in DLLs?
提问by Jim Buck
I have a .exe and many plug-in .dll modules that the .exe loads. (I have source for both.) A cross-platform (with source) solution would be ideal, but the platform can be narrowed to WinXP and Visual Studio (7.1/2003 in my case).
我有一个 .exe 和许多 .exe 加载的插件 .dll 模块。(我有两者的源代码。)跨平台(带源代码)解决方案是理想的,但平台可以缩小到 WinXP 和 Visual Studio(在我的情况下为 7.1/2003)。
The built-in VS leak detector only gives the line where new/malloc was called from, but I have a wrapper for allocations, so a full symbolic stack trace would be best.
内置的 VS 泄漏检测器仅提供调用 new/malloc 的行,但我有一个用于分配的包装器,因此最好使用完整的符号堆栈跟踪。
The detector would also be able to detect for a leak in both the .exe and its accompanying plug-in .dll modules.
检测器还能够检测 .exe 及其随附的插件 .dll 模块中的泄漏。
采纳答案by Zooba
I personally use Visual Leak Detector, though it can cause large delays when large blocks are leaked (it displays the contents of the entire leaked block).
我个人使用Visual Leak Detector,尽管当大块泄漏时它会导致很大的延迟(它显示整个泄漏块的内容)。
回答by davidag
If you don't want to recompile (as Visual Leak Detector requires) I would recommend WinDbg, which is both powerful and fast (though it's not as easy to use as one could desire).
如果您不想重新编译(如 Visual Leak Detector 所要求的那样),我会推荐WinDbg,它既强大又快速(尽管它不像人们希望的那样易于使用)。
On the other hand, if you don't want to mess with WinDbg, you can take a look at UMDH, which is also developed by Microsoft and it's easier to learn.
另一方面,如果你不想弄乱WinDbg,你可以看看UMDH,它也是微软开发的,更容易学习。
Take a look at these links in order to learn more about WinDbg, memory leaks and memory management in general:
查看这些链接以了解有关 WinDbg、内存泄漏和一般内存管理的更多信息:
回答by Anders Sandvig
I have had good experiences with Rational Purify. I have also heard nice things about Valgrind
我在Rational Purify方面有很好的经验。我也听说过 Valgrind 的好消息
回答by MastAvalons
As for me I use deleaker to locate leaks. I am pleased.
至于我,我使用 deleaker 来定位泄漏。我很满意。
回答by Stewart Lynch
回答by Idanuda
As several of my friend has posted there are many free leak detectors for C++. All of that will cause overhead when running your code, approximatly 20% slower. I preffer Visual Leak Detector for Visual C++ 2008/2010/2012, you can download the source code from - enter link description here.
正如我的几个朋友发布的那样,有许多免费的 C++ 泄漏检测器。所有这些都会在运行代码时造成开销,大约慢 20%。我更喜欢Visual C++ 2008/2010/2012 的 Visual Leak Detector,你可以从这里下载源代码 -在此处输入链接描述。
回答by Agnel Kurian
Try Jochen Kalmbach's Memory Leak Detectoron Code Project. The URL to the latest version was somewhere in the comments when I last checked.
在代码项目中试用Jochen Kalmbach 的内存泄漏检测器。我上次检查时,最新版本的 URL 在评论中的某个位置。