GNOME Bugzilla – Bug 681934
Memory leaks in gtk.ProgressBar
Last modified: 2013-05-07 23:19:54 UTC
The follow code leaks memory. It's about 2 MB/sec on my system. Quite significant! It eventually crashes during a call in libcairo-2.dll after memory usage reaches 2 GB. import gtk progress_window = gtk.Window(gtk.WINDOW_TOPLEVEL) progress_bar = gtk.ProgressBar() progress_window.add(progress_bar) progress_window.show_all() while True: progress_bar.set_text("xxx") while gtk.events_pending(): gtk.main_iteration() I'm using the libraries installed by the PyGTK all-in-one installer 2.24.2. (Gtk+ runtime packages version 2.24.10-1).
Just updating the progress bar leaks memory: import gtk progress_window = gtk.Window(gtk.WINDOW_TOPLEVEL) progress_bar = gtk.ProgressBar() progress_window.add(progress_bar) progress_window.show_all() i=0 while True: progress_bar.set_fraction(i) i+=0.01 if i > 1.0: i = 0.0 while gtk.events_pending(): gtk.main_iteration() Pulsing does as well: import gtk progress_window = gtk.Window(gtk.WINDOW_TOPLEVEL) progress_bar = gtk.ProgressBar() progress_window.add(progress_bar) progress_window.show_all() while True: progress_bar.pulse() while gtk.events_pending(): gtk.main_iteration() Setting the fraction to the same constant value does NOT leak memory.
The patch for 685959 fixes this problem. *** This bug has been marked as a duplicate of bug 685959 ***