Re: memory leak in gtk



c f wrote:
<snip>

I have checked the GTK documentation and it states that gtk_exit free
all resources allocated for GTK+. gtk_exit is depricated and using
exit is recommended. I have tested both but non of them improved the
situation (still more than 5000 leaks).

This is normal.  GTK is not going to clean up, nor can it, every single
allocation it makes.  However this is not a problem.  GTK will not leak
more and more memory over time.  Only sunk resources are leaked, such as
global data structures.

Most people who try to find leaks in their GTK programs will use a tool
like valgrind with a large gtk-specific suppression file.  A memory leak
is a memory leak, but it's only those leaks that accumulate that are a
problem.  Sometimes I'll use a memory profiler and make sure my
program's memory use doesn't increase beyond bounds.  One trick is to
rename main() and then write a temporary main() that calls the real main
thousands of times.  Over time the memory use should never exceed a
certain ceiling.  Of course with GTK being used for interactive things,
this is a bit difficult.

Anyway, google around for valgrind suppression files for GTK apps and
then give your app a shot.  You should readily be able to find your own
leaks, that really do matter.


Please could you help if I missed some cleanup in my application or
what is happening?

Thanks,
Csaba
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list





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