Re: Valgrind and GTK



There has definitely been a degradation in the ability
of valgrind to find memory leaks in gtk+ applications
over the past, say, 5 years.

I think the basic problem is that there are more singletons
and that gtk+ object hold more pointers to other objects
than they used to.

IMHO, the situation could be greatly improved if there was
a gtk+ function, say gtk_cleanup, that

* Eliminated singletons
* Cleared caches
* Called similar cleanup functions for libraries used by gtk+

subject to the constraint that gtk_cleanup should leave the
library in a usable state (and hence that you can call it as
often as you want -- that's important for a library).

Both fontconfig and cairo got this last point wrong.  Their
cleanup functions are basically only good for asserting
that there were no leaks which is not helpful in the gtk+
case.  As a consequence, pango is unable to clean up
its object allocations.  And I can't even blame Behdad.

Maybe there should also be a function to handle all pending
events at exit so the display related structures are not leaked.

Note: the above proposal does nothing to address the type
system related leaks, but they are the ones best suited for
suppressions anyway.

Morten


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