在 linux 上查找泄漏的 valgrind (memcheck) 的替代方法?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7410160/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 06:10:55  来源:igfitidea点击:

Alternative to valgrind (memcheck) for finding leaks on linux?

linuxmemory-leaksvalgrind

提问by jhfrontz

I have a linux x86 application that makes use of various third-party shared-object libraries. I suspect these libraries are leaking memory (since it can't possibly be mycode ;-)

我有一个使用各种第三方共享对象库的 linux x86 应用程序。我怀疑这些库正在泄漏​​内存(因为它不可能是我的代码;-)

I tried the trusty valgrind, but it died a horrible death because one of the third-party libraries is using an obscure x86 instructionthat valgrind doesn't implement.

我尝试了值得信赖的Valgrind的,但因为死了可怕的死亡第三方库之一是使用一个不起眼的x86指令Valgrind的未实现

I found a recommendation for DUMAand gave it a try (using the LD_PRELOAD technique to bring DUMA in at run-time), but it aborted complaining about a free operation on memory that wasn't allocated via DUMA (almost certainly by some constructor of a static object in one of the previously mentioned third-party libraries).

我找到了对 DUMA 的推荐并尝试了它(使用 LD_PRELOAD 技术在运行时引入 DUMA),但它中止了对未通过 DUMA 分配的内存的自由操作的抱怨(几乎肯定是由某些构造函数前面提到的第三方库之一中的静态对象)。

Are there other run-time-linkable (or otherwise not requiring a recompilation/relink) tools around that will work on linux?

是否有其他运行时可链接(或不需要重新编译/重新链接)的工具可以在 linux 上运行?

回答by Mircea

The TotalView debugger(or, more precisely, its Memscope) has a feature set similar to the one of Valgrind.

TotalView软件调试器(或者,更准确地说,它Memscope)具有类似Valgrind的的一个功能集。

You can also try Electric Fence(original author's link) (the origin of DUMA) for buffer overflows or touch-after-free cases (but not for memleaks, though).

你也可以试试电动围栏原作者的链接)(DUMA 的起源)用于缓冲区溢出或 touch-after-free 情况(但不适用于 memleaks)。

回答by 0xC0000022L

Give Dr. Memorya try. It is based on DynamoRIOand shares many of the features with Valgrind.

内存博士一试。它基于DynamoRIO,并与 Valgrind 共享许多功能。

回答by d99kris

Heapusageis a simple run-time tool for finding memory leaks on Linux and macOS. The output logging format for leaks is quite similar to Valgrind, but it only logs definite leaks (i.e. allocations not free'd at termination).

Heapusage是一个简单的运行时工具,用于在 Linux 和 macOS 上查找内存泄漏。泄漏的输出日志格式与 Valgrind 非常相似,但它只记录确定的泄漏(即在终止时未释放的分配)。

Full disclosure: I wrote Heapusage for usage in situations when Valgrind is inadequate (high performance applications, and also for CPU architectures not supported by Valgrind).

全面披露:我编写了 Heapusage 用于 Valgrind 不足的情况(高性能应用程序,以及 Valgrind 不支持的 CPU 架构)。