[Interest] Possible memory leak.

Thiago Macieira thiago.macieira at intel.com
Tue Jun 18 21:01:40 CEST 2013


On terça-feira, 18 de junho de 2013 13.23.38, william.crocker at analog.com 
wrote:
> On 06/18/2013 01:05 PM, Thiago Macieira wrote:
> > On terça-feira, 18 de junho de 2013 08.37.18, Bill Crocker wrote:
> >> I have written a server app with Qt (4.7.1) and the image size grows over
> >> time. Valgrind found this.
> >> Are we missing a call to freeaddrinfo somewhere?
> > 
> > No.
> 
> You seem pretty sure of yourself.

I am.

First of all, your backtrace had absolutely no proof that it came from a 
missed freeaddrinfo. It shows memory allocated during a getaddrinfo lookup, 
that's all. For all you've shown, it could be a simple static pointer in 
nss_ldap. Or it could be a leak caused by a bug in nss_ldap.

Second, getaddrinfo is called at qhostinfo_unix.cpp:206 and 211. If it returns 
with success, freeaddrinfo is called on line 247. There is no return in-
between those lines. Therefore, it's impossible to miss the freeaddrinfo.

> If I remember correctly, you were pretty sure of yourself
> when I suggested there might be a leak in the QThreadPool class.
> I wrote my own and now that problem has gone away.

I don't remember the details. QThreadPool has had some race condition fixes 
applied recently.

> This is an MT app so it could be the process is exiting
> with the freeaddrinfo pending.

A leak caused by exiting without cleaning up all threads is not a leak.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130618/5343c48a/attachment.sig>


More information about the Interest mailing list