使用QT和MinGW32在Windows上进行内存泄漏检查 [英] Memory leak checking on Windows with QT and MinGW32

查看:724
本文介绍了使用QT和MinGW32在Windows上进行内存泄漏检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我一直在使用QT Creator开发C ++。一切都很好,我几乎可以打包和分发我的应用程序了。但是显然,在发布任何版本之前,最好确保一切正确。因此,我处于测试阶段,有些事情告诉我,我有一些轻微的内存问题。没什么严重的,但是我喜欢这些;-)。

Lately I have been developing in C++ with QT Creator. All is well and I'm nearly at the point of packaging and distributing my application. But obviously before any release you better make sure you have everything right. So I'm at the testing stage, and something tells me that I have some slight memory issues. Nothing serious, but I like to obsess over these ;-).

所以我决定尝试一些内存泄漏检测库。首先,我看了这个问题。由于费用,我无视Purify和Insure ++。有人建议使用MSVC编译器,以便我可以使用CRT内存验证例程。我考虑过,但现在决定反对,因为这可能会对从QT Creator中使用调试器产生影响。

So I decided to try some memory leak detection libraries. For starters I looked at this question. I disregarded Purify and Insure++ because of the costs. Someone else suggested to use the MSVC compiler so I could use the CRT memory validation routines. Which I considered but decided against for now because of the implications it would have on using the debugger from within QT Creator.

然后,我偶然发现了 DUMA ,我必须使用QT随附的MinGW32编译器进行编译。但是,我发现由于大量细分错误,QT不能很好地发挥作用。我知道他们是DUMA的工作方式,但是我敢肯定,我没有像DUMA那样使事情变得如此艰难。

Then I stumbled across DUMA which I got to compile using the MinGW32 compiler that comes with QT. However, I found that it doesn't really play well with QT because of the incredible amount of segmentation faults. I know they are how DUMA works, but I'm pretty sure I did not screw things up as much as DUMA tried to make me believe.

我尝试过的另一件事是我很遗憾无法使用MinGW32版本进行编译的 google-performance-tools

Another something I tried was the google-performance-tools which I sadly cannot get to compile with the MinGW32 version supplied with QT, even if I add in the required dependencies.

所有这些都使我想到我的问题:对于QT Creator开发人员来说,有没有可行的解决方案?

All of this brings me to my question: Is there any working solution out there for QT Creator developers that want to check their programs for memory leaks?

谢谢,

推荐答案

我个人发现 valgrind / memcheck / callgrind / kcachegrind 组合太强大而无法传递给内存泄漏和性能分析。免费(免费)特别好,因为我个人无法负担其他一些专业工具的费用。

Personally, I find the valgrind / memcheck / callgrind / kcachegrind combo to be too powerful to pass up for memory leaks and performance analysis. Being free (gratis) is especially nice since I cannot personally afford the cost of some of these other professional tools.

我一直在从事跨平台Qt应用程序的开发工作,几年了。在开发过程中,当我要测试特性时,我会在Windows和Linux之间来回跳动。但是,我总是在linux中进行性能分析。我发现内存泄漏和性能问题始终是由我的开发团队在Qt之上注入的。因此,解决这些问题后,无论在Linux中发现什么,其好处都将延续到Windows中。

I've been working on a cross platform Qt application for a couple years now. As I develop, I bounce back and forth between windows and linux when I want to test features and functionality. However, I always do my performance analysis in linux. The memory leaks and performance concerns that I find are always ones that are injected by my team of developers on top of Qt. So when these problems are fixed, regardless of being identified in Linux, the benefits will carry over into windows.

我建议您研究建立一个纯Linux构建环境,可以进行测试。对您来说,最简单的解决方案是创建一个虚拟机来进行性能分析。我首选的组合是 VirtualBox Ubuntu

I suggest you investigate setting up a pure linux build environment that you can test in. Perhaps the easiest solution for you would be to create a virtual machine to do your performance analysis on. My preferred combination is VirtualBox and Ubuntu.

这篇关于使用QT和MinGW32在Windows上进行内存泄漏检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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