GNOME Bugzilla – Bug 683246
Memory Leak in GtkSpinner
Last modified: 2015-06-13 17:44:48 UTC
GTK Spinners leak memory when spinning and visible. If you hide the widget, or stop it spinning, the memory usage does not go up, but it does not reset either. Memory usage will continue to climb once you start it visibly spinning again. It also leaks when behind another window (for instance a terminal). Minimalistic example: -- import gtk window = gtk.Window() spinner = gtk.Spinner() window.add(spinner) spinner.start() window.show_all() gtk.main() -- Run the example and watch the python process memory usage climb up by a few Kb per second. It isn't a very quick leak, but anything that relies on GTK Spinners will crash after several days once the memory usage gets too high. One example (of many) is Glade, with a visible spinner, left open over a weekend, will result in a crash by the time you come in on Monday morning. This bug makes it difficult to have long running, robust programs.
*** Bug 684843 has been marked as a duplicate of this bug. ***
it would be nice if you could run your example under Valgrind to detect the leak; you can follow the instructions here: https://live.gnome.org/Valgrind
Hi Emmanuele, I might be missing something, but Valgrind appears to only run under linux and OSX. This is a bug that exists on windows only, I've tested under linux and spinners do not leak there. Cheers,
Further to the comment posted by Andre in the duplicate bug, it cannot be tested with PyGObject since PyGObject doesn't work on windows as far as I know (this makes me wonder why PyGTK is considered deprecated, but anyway...). Since the bug also exists in Glade, it is clearly a gtk+ bug, not a pygtk bug anyway. Apologies for selecting the wrong category. I'm going to attempt to change the product category for this bug to gtk+.
Currently, GTK widgets on Windows leaks on every redraw (see bug 685959), so as the spinner triggers some redraws for its animation, it's a possible duplicate. Would it be possible for you to test if the patch provided there would fix your problem?
For what it is worth I don't see any problem with the X backend. Does this still occur for you now that bug 685959 is fixed?
As i'm a PyGTK user, it is a bit difficult for me to test. I'd have to get the latest gtk+ development source (since no release with this fix has been made) and then attempt to compile pygtk with it. I could probably work out how to do this eventually, but can't really dedicate the time to learn. It would be far simpler if you could find someone who programs in gtk+ directly to test (which is probably what you are after anyway)
Thanks for taking the time to report this. Closing as duplicate of 685959. Feel free to reopen if you find out that it's actually a different issue. *** This bug has been marked as a duplicate of bug 685959 ***