如何在 Linux (Ubuntu OS) 中检测 C++ 应用程序的内存泄漏?

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

How I can detect memory leaks of C++ application in Linux (Ubuntu OS)?

c++linuxubuntumemory-leaks

提问by G-71

How I can detect memory leaks of C++ application in Linux (Ubuntu OS) ? What is the program you can advise me for this goal ?

如何在 Linux (Ubuntu OS) 中检测 C++ 应用程序的内存泄漏?为了这个目标,你可以给我建议什么程序?

采纳答案by Cody

Check out Valgrind, it should be in the Ubuntu repository. it can give you detailed information about memory usage in C++ programs. Kind of like a debugger for memory usage.

查看Valgrind,它应该在 Ubuntu 存储库中。它可以为您提供有关 C++ 程序中内存使用情况的详细信息。有点像内存使用的调试器。

valgrind --tool=memcheck <your_app> <your_apps_params>

回答by jonsca

Use Valgrindfor that purpose.

为此目的使用Valgrind

回答by Sonorx

also may look ccmalloc, NJAMD, mpatrol, YAMD, LeakTracer

也可以看ccmalloc, NJAMD, mpatrol, YAMD, LeakTracer

回答by Deve

If open source software isn't mandatory you could also check out Purify

如果开源软件不是强制性的,您还可以查看Purify