Bill Cheatham
Bill Cheatham

Reputation: 11917

Using 'Analyze Memory' tool in Qt Creator

I am using Qt Creator to develop a C++ application, and I am trying to track down some memory leaks.

I have followed these instructions*, and have Valgrind isntalled on my Ubuntu machine.

I begin my application from the Analyze Memory section, and after clicking the stop button I am told that Tool Analyze Memory finished, 928 issues found. However, no results appear in the analysis section, which remains blank.

Am I doing something wrong? Where can I find the results of the memory analysis?


*Confusingly, the instructions ask for a 'release' build configuration, but selecting this causes a warning in Qt saying that the memory analysis tool requires a debug configuration. I have tried both ways round.

Upvotes: 8

Views: 8018

Answers (2)

Jorge Leitao
Jorge Leitao

Reputation: 20103

You did nothing wrong. In the Valgrind menu, press the Filter icon and select External Errors. You will see all issues appearing. Those are most likely not from your application, but Qt- or else-related, so you can often ignore them.

X issues found refers to the total number of issues; when External Errors is unselected, only those related to your app show up. If none appears, Valgrind has not detected any memory leak in your app.

Upvotes: 1

Maciej
Maciej

Reputation: 3723

I've checked it in my Qt Creator and it works. I'm using version 2.3.1 with Qt 4.7.4 and Valgrind 3.7.0. I've tested it on dropsite example with Debug build configuration. I've also tested it with my CMake based project (compiled with -g and -O0 flags) and it also worked. Make sure, that next to start button Valgrind Memory Analyzer is chosen. On the same bar you'll find arrow icons. Next to them is icon of funnel (I think). Click it and make sure that types of errors you're interested in are checked.

If it won't work, and you don't want to use Valgrind tools from console, there are other Valgrind GUIs like Valkyrie.

EDIT: I've updated Qt Creator to version 2.4.0rc1 and checked it with my CMake project. It also showed no results, while reporting few hundred issues. Solution to this was checking External errors after clicking funnel icon.

EDIT2: In final 2.4.0 issue was fixed.

Upvotes: 11

Related Questions