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

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

问题描述

有没有人知道我在哪里可以找到一个内存内存泄漏检测工具的C ++,可以在命令行运行或作为Eclipse插件在Windows和Linux。我想它很容易使用。最好不要覆盖new(),delete(),malloc()或free()。像GDB的东西,如果它会在命令行中,但我不记得用于检测内存泄漏。

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.

这个问题类似于其他问题(例如http://stackoverflow.com/questions/283726/memory-leak-detection-under-windows-for- gnu-cc )但是我觉得它是不同的,因为那些请求windows具体的解决方案或我想避免的解决方案。我觉得我在这里寻找一些更具体的东西。建议不必满足所有要求,但尽可能多的会很好。

This question is similar to other questions (such as http://stackoverflow.com/questions/283726/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.

感谢。

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

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:我不担心我的代码的跨平台兼容性,它是一个只使用C ++库的命令行应用程序。

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

推荐答案

Valgrind 是您的最好的朋友。 Valgrind有一个插件用于eclipse。
可悲的是Valgrind不在Windows上运行,但它运行在Mac OSX,* BSD和Linux,所以我认为多平台。 :)

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在编译时不会覆盖new / delete / malloc / free,所以如果这是你的意思,你不必重新编译。它解释二进制,所以性能在测试期间有点。

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天全站免登陆