Re: Does GTK leak memory



On Wed, 2010-06-02 at 09:07 -0700, Nader Morshed wrote:
> How would one go about testing their own application, with the fact that GTK does not free some of its memory, in order to make sure the application isn't leaking memory? I suppose that you could just look at a list of processes and note when a repeated task (Opening/closing a window, connecting/disconnecting from a server/etc) increases the memory of the process, but this is hardly efficient, and can sometimes be fooled by the fact that the libraries cache their memory.

it's not just GTK: at all levels of the stack there are one-off
allocations that will be flagged as false positives; font-config,
freetype2, pango, cairo, X11, you name it.

gtk+ has the added bonus that it can be used in run-time loadable
plugin, so (as it has been said) it cannot use an atexit() function
reliably and cross-platform.

> What would be a better way of diagnosing memory leaks in an application?

use a valgrind suppression file. man valgrind to know how to use (and
make) one.

ciao,
 Emmanuele.

-- 
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]