Re: Memory leak in GTK+ ?




Georg Greve <greve@fusebox.hanse.de> writes:

> -----BEGIN PGP SIGNED MESSAGE-----
> 
> Hi !
> 
> I have been watching the new version of my xlogmaster (1.3.0) pretty
> closely, because I had to do some new memory handling.
> 
> Well watching it really closely I noticed that the xlogmaster grew in
> memory over time... I checked it out for a while and it seems that it
> even grew when switching between logfiles.
> 
> The ONLY thing that happens on my part when switching between them is
> basically clearing the GtkText widget and then displaying another
> buffer in it. There is *no memory allocation on my side* there but the
> xlogmaster grows... so I am kinda suspicious of the GtkText widget to
> cause this (especially because it is known to be flawed) and would
> like to know whether anyone else has noticed similar things.

Hmm, a number of memory problems have been fixed in GtkText since
1.0.4. It's probably about time for a 1.0.5 (though I think
I still need to backport some of them from the 1.1 branch)

> The other thing that seems to enlarge the xlogmaster is
> reconfiguration. During reconfiguration there is a lot of allocation
> and deallocation doing on so it is possible that I forgot to free some
> array somewhere - although I don't think so. I looked through the
> source and found the free command for every block I allocated and the
> program should always run through them no matter what. So I am also
> suspicious of the GTK+ there but I can't be too sure whether it is the
> problem of the GTK+ toolkit.
 
As well leaking memory allocations you make directly, you could
also be leaking GTK+ data structures. For instance, you have
to remember to explicitely call gdk_pixmap_unref() on pixmaps
you create. There is no easy way to check for this, but for
GtkObjects, if you compiled GTK+ with --enable-debug (you
should have), you can run your program as:

 myprog --gtk-debug=objects

There could well be leaks in GTK+ somewhere, though at least
testgtk tested out cleanly with Purify in the not too distant
past.
 
> Everyone who is interested in this is VERY welcome to pull down the
> recent development version from
> 
> 	http://www.fusebox.hanse.de/xlogmaster/development/
> 		or
> 	http://porter.desy.de/~greve/xlogmaster/development/
> 
> because I'd be very grateful of you could find a mistake on my
> side... I am relatively sure that at least the GtkText widget is leaky,
> though.

Regards,
                                        Owen



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