Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Memory leak checking on Windows with QT and MinGW32

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 ;-).

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.

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.

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.

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?

Thanks,

like image 594
StanB123 Avatar asked Dec 24 '10 16:12

StanB123


People also ask

Which testing is used for checking and resolving memory leaks?

Memory testing involves validating a C or C++ application's use of memory and looking for memory leaks or illegal management of memory, such as buffer overwrites. Memory leaks can be catastrophic to an application, resulting in hangs, buffering, or crashes.


1 Answers

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.

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.

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.

like image 84
perden Avatar answered Sep 25 '22 02:09

perden