G ++多平台内存泄漏检测工具 [英] G++ Multi-platform memory leak detection tool

查看:114
本文介绍了G ++多平台内存泄漏检测工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道在哪里可以找到C ++的内存内存泄漏检测工具,可以在命令行中运行,也可以在Windows和Linux中运行Eclipse插件。我希望它很容易使用。最好是不覆盖new(),delete(),malloc()或者free()的。像GDB这样的东西,如果它在命令行,但我不记得被用来检测内存泄漏。如果有一个单元测试框架自动执行,那将是很好的。



这个问题与其他问题类似(例如 Windows下的内存泄漏检测GNU C / C ++ )然而,我觉得它是不同的,因为那些问对于Windows特定的解决方案或者我宁可避免的解决方案。我觉得我正在寻找更具体的东西。



谢谢。



编辑:由于这已经出现,通过覆盖我的意思是要求我#include一个库,否则改变C ++编译我的代码的任何东西,如果它在运行时这样做,以便在不同的环境中运行代码不会影响任何伟大的事情。此外,不幸的是,我没有Mac,所以任何建议,这是无益的,但谢谢你的尝试。我的桌面运行Windows(我已经安装了Linux,但我的双显示器不能使用它),我宁可不在虚拟机中运行Linux,尽管这当然是一个选择。我的笔记本电脑运行Linux,所以我可以使用那个工具,虽然我一定会喜欢坚持到我的桌面,因为屏幕空间是非常好的保持所有的设计文档和要求的视图,而不必在桌面上移动太多



注意:虽然我可以尝试回答,但我不会将其标记为已接受,直到我尝试了这个建议,并且令人满意。



EDIT2:我不担心我的代码的跨平台兼容性,它只是使用C ++库的命令行应用程序。

解决方案

Valgrind 是您的。rel =noreferrer>。 Valgrind针对eclipse有一个插件
可悲的是Valgrind不在Windows上运行,但它运行在Mac OSX,* BSD和Linux上,所以我认为多平台。 :)



Valgrind在编译时不会覆盖新的/删除/ malloc / free,所以你不需要重新编译,如果这是你的意思)。它解释二进制,所以在测试过程中性能受到一点影响。


Does anyone know where I can find a memory memory leak detection tool for C++ which can be either run in a command line or as an Eclipse plug-in in Windows and Linux. I would like it to be easy to use. Preferably one that doesn't overwrite new(), delete(), malloc() or free(). Something like GDB if its gonna be in the command line, but I don't remember that being used for detecting memory leaks. If there is a unit testing framework which does this automatically, that would be great.

This question is similar to other questions (such as Memory leak detection under Windows for GNU C/C++ ) however I feel it is different because those ask for windows specific solutions or have solutions which I would rather avoid. I feel I am looking for something a bit more specific here. Suggestions don't have to fulfill all requirements, but as many as possible would be nice.

Thanks.

EDIT: Since this has come up, by "overwrite" I mean anything which requires me to #include a library or which otherwise changes how C++ compiles my code, if it does this at run time so that running the code in a different environment won't affect anything that would be great. Also, unfortunately, I don't have a Mac, so any suggestions for that are unhelpful, but thank you for trying. My desktop runs Windows (I have Linux installed but my dual monitors don't work with it) and I'd rather not run Linux in a VM, although that is certainly an option. My laptop runs Linux, so I can use that tool on there, although I would definitely prefer sticking to my desktop as the screen space is excellent for keeping all of the design documentation and requirements in view without having to move too much around on the desktop.

NOTE: While I may try answers, I won't mark one as accepted until I have tried the suggestion and it is satisfactory.

EDIT2: I'm not worried about the cross-platform compatibility of my code, it's a command line application using just the C++ libraries.

解决方案

Valgrind is your best friend. Valgrind has a plugin for eclipse. "Sadly" Valgrind does not run on Windows, but it runs on Mac OSX, *BSD and Linux, so I'd consider that "multi-platform". :)

Valgrind does "overwrite" new/delete/malloc/free but not during compilation (so you don't have to recompile if that's what you mean). It interprets the binary so the performance suffer a bit during testing.

这篇关于G ++多平台内存泄漏检测工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆