Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, October 2007
Valgrind / memory leak search


Message 1 in thread

Hi,

currently I'm searching memory leaks in my Qt apps under linux with
Valgrind. I discovered hundreds of leaks in Qt/X11 objects -
no chance to discover the "real memory leaks.

So has anybody experiences in Valgrind and Qt?

The current problem is, that QImage allocs memory which isn't freed
at program end - so valgrind declared this as "still reachable".

Any hints are appreciated - searching the list and google didn't
help so far.

Best Regards,
Christian


--
 [ signature omitted ] 

Message 2 in thread

On Thursday October 11 2007 13:43:42 Christian Dähn wrote:
> Hi,
>
> currently I'm searching memory leaks in my Qt apps under linux with
> Valgrind. I discovered hundreds of leaks in Qt/X11 objects -
> no chance to discover the "real memory leaks.

The standard solution is to use suppression files:

http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress

Normally, you can find premade suppression files for libraries on the net, but 
I drew a blank with a quick search. Still, it might be worth a try.

-- 
 [ signature omitted ] 

Message 3 in thread

Esben Mose Hansen wrote:
> On Thursday October 11 2007 13:43:42 Christian Dähn wrote:
>> Hi,
>>
>> currently I'm searching memory leaks in my Qt apps under linux with
>> Valgrind. I discovered hundreds of leaks in Qt/X11 objects -
>> no chance to discover the "real memory leaks.
>
> The standard solution is to use suppression files:
>
> http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress
>
> Normally, you can find premade suppression files for libraries on the net,
> but
> I drew a blank with a quick search. Still, it might be worth a try.
>

Yep, the last one I found was for qt-3.1.1 - see

http://lists.trolltech.com/qt-interest/2003-09/thread01532-0.html

Since this comes up regularly and I will have to valgrind some qt based
code in the next couple weeks I might make some suppression files for qt
4.3.2 unless somebody else steps up.

Cheers,

Michael


> regards, Esben
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>


--
 [ signature omitted ] 

Message 4 in thread

Hi,

The solution with suppression files is known, but till today I didn't found
any current files in the net.

> Since this comes up regularly and I will have to valgrind some qt based
> code in the next couple weeks I might make some suppression files for qt
> 4.3.2 unless somebody else steps up.

That would be great! I currently have nearly 400 Qt related messages in
Valgrind and no time to check them all - because just putting them into
a suppression file isn't a good way.

I read in some changelogs of openSuSE that they already have some
current suppression files - but I don't have any direct eMail address
to contact the developers.

ciao,
Christian


--
 [ signature omitted ] 

Message 5 in thread

On Thursday 11 October 2007, Christian Dähn wrote:
> Hi,
>
> The solution with suppression files is known, but till today I didn't found
> any current files in the net.
>
> > Since this comes up regularly and I will have to valgrind some qt based
> > code in the next couple weeks I might make some suppression files for qt
> > 4.3.2 unless somebody else steps up.
>
> That would be great! I currently have nearly 400 Qt related messages in
> Valgrind and no time to check them all - because just putting them into
> a suppression file isn't a good way.
>
> I read in some changelogs of openSuSE that they already have some
> current suppression files - but I don't have any direct eMail address
> to contact the developers.


Valgrind has an option to output suppression file contents (see the man page). 
It is trivial to copy and paste these into a suppression file..

Flo


-- 
 [ signature omitted ] 

Message 6 in thread

> Valgrind has an option to output suppression file contents (see the man page). 
> It is trivial to copy and paste these into a suppression file..

That's right, I know this option - but you have to copy and paste the suppression
infos for each message separately. As I mentioned before I currently have up to 
400 messages per app - so this is very hard.

Further I would prefer to check each message so I don't suppress real errors
accidentially.

ciao,
Christian


--
 [ signature omitted ] 

Message 7 in thread

If valgrind reports a leak, doesn't that indicate that either A) QT 
actually leaks, or B) valgrind is buggy? Or, am I missing something?


		Martin

Esben Mose Hansen wrote:
> On Thursday October 11 2007 13:43:42 Christian Dähn wrote:
>> Hi,
>>
>> currently I'm searching memory leaks in my Qt apps under linux with
>> Valgrind. I discovered hundreds of leaks in Qt/X11 objects -
>> no chance to discover the "real memory leaks.
> 
> The standard solution is to use suppression files:
> 
> http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress
> 
> Normally, you can find premade suppression files for libraries on the net, but 
> I drew a blank with a quick search. Still, it might be worth a try.
> 

--
 [ signature omitted ] 

Message 8 in thread

It can also be  C) Qt doesn't free everything that it allocates into 
global pointers
because the only time it makes sense to do that is when the program 
exits. In this
case, the only good it's doing is for the developer (like you.) The end 
user just sees
the program take longer to exit (not really a benefit.)

C) doesn't preclude A) or B) but that's not the way to bet.

Martin Olsson wrote:
> If valgrind reports a leak, doesn't that indicate that either A) QT 
> actually leaks, or B) valgrind is buggy? Or, am I missing something?
>
>
>         Martin
>
> Esben Mose Hansen wrote:
>> On Thursday October 11 2007 13:43:42 Christian Dähn wrote:
>>> Hi,
>>>
>>> currently I'm searching memory leaks in my Qt apps under linux with
>>> Valgrind. I discovered hundreds of leaks in Qt/X11 objects -
>>> no chance to discover the "real memory leaks.
>>
>> The standard solution is to use suppression files:
>>
>> http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress
>>
>> Normally, you can find premade suppression files for libraries on the 
>> net, but I drew a blank with a quick search. Still, it might be worth 
>> a try.
>>
>
> -- 
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>

--
 [ signature omitted ] 

Message 9 in thread

On Friday October 12 2007 08:51:11 Martin Olsson wrote:
> If valgrind reports a leak, doesn't that indicate that either A) QT
> actually leaks, or B) valgrind is buggy? Or, am I missing something?

If QT just leaves a global pointer, valgrind should report the memory as still 
reachable. I have yet to catch it reporting "definitely lost" without it 
being so, but without investigating, it's hard to say for sure.

-- 
 [ signature omitted ]