After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 681934 - Memory leaks in gtk.ProgressBar
Memory leaks in gtk.ProgressBar
Status: RESOLVED DUPLICATE of bug 685959
Product: pygtk
Classification: Bindings
Component: gtk
2.24.x
Other Windows
: Normal major
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2012-08-15 17:52 UTC by Steven T. Snyder
Modified: 2013-05-07 23:19 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Steven T. Snyder 2012-08-15 17:52:28 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).
Comment 1 Steven T. Snyder 2013-03-08 18:53:16 UTC
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.
Comment 2 Steven T. Snyder 2013-05-07 23:19:54 UTC
The patch for 685959 fixes this problem.

*** This bug has been marked as a duplicate of bug 685959 ***