Public bug reported:

Binary package hint: indicator-application

It seems that there is a memory leak whenever set_menu() is called to
generate an indicator menu. I have written an RSS feed reading program
that re-creates the menu at a timed interval. Memory usage increases by
up to 3-4Mb whenever set_menu() is called. I have run the script with
just set_menu() commented out, and there is no increase in memory usage.

I have python-appindicator version 0.0.19-0ubuntu4 in Lucid although I
believe it applies to newer versions too, such as the one in Maverick.

Further discussion of the issue here:
http://code.google.com/p/feedindicator/issues/detail?id=10

One commenter submitted a test script which demonstrates the memory
increasing over time:

# MEMORY LEAK TEST SCRIPT

#!/usr/bin/env python

import gtk, gobject, appindicator, time, glib

def refresh():
        global ind
        global menu
        print("updating")
        for menu_item in menu.get_children():
                menu.remove(menu_item)
                menu_item.destroy()
        for i in range(0,20):
                menu_item = gtk.MenuItem("item "+str(i))
                menu_item.show()
                menu.append(menu_item)
        ind.set_menu(menu)
        return 1

ind = appindicator.Indicator ("bug-test","indicator-messages-new", 
appindicator.CATEGORY_COMMUNICATIONS)
ind.set_status (appindicator.STATUS_ACTIVE)

menu = gtk.Menu()
ind.set_menu(menu)

glib.timeout_add_seconds(2, refresh)
gtk.main()

** Affects: indicator-application (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  Binary package hint: indicator-application
  
  It seems that there is a memory leak whenever set_menu() is called to
  generate an indicator menu. I have written an RSS feed reading program
  that re-creates the menu at a timed interval. Memory usage increases by
  up to 3-4Mb whenever set_menu() is called. I have run the script with
  just set_menu() commented out, and there is no increase in memory usage.
  
  I have python-appindicator version 0.0.19-0ubuntu4 in Lucid although I
  believe it applies to newer versions too, such as the one in Maverick.
  
  Further discussion of the issue here:
  http://code.google.com/p/feedindicator/issues/detail?id=10
  
  One commenter submitted a test script which demonstrates the memory
  increasing over time:
  
+ # MEMORY LEAK TEST SCRIPT
+ 
  #!/usr/bin/env python
  
  import gtk, gobject, appindicator, time, glib
  
  def refresh():
-         global ind
-         global menu
-         print("updating")
-         for menu_item in menu.get_children():
-                 menu.remove(menu_item)
-                 menu_item.destroy()     
-         for i in range(0,20):
-                 menu_item = gtk.MenuItem("item "+str(i))
-                 menu_item.show()
-                 menu.append(menu_item)
-         ind.set_menu(menu)
-         return 1
-         
+         global ind
+         global menu
+         print("updating")
+         for menu_item in menu.get_children():
+                 menu.remove(menu_item)
+                 menu_item.destroy()
+         for i in range(0,20):
+                 menu_item = gtk.MenuItem("item "+str(i))
+                 menu_item.show()
+                 menu.append(menu_item)
+         ind.set_menu(menu)
+         return 1
+ 
  ind = appindicator.Indicator ("bug-test","indicator-messages-new", 
appindicator.CATEGORY_COMMUNICATIONS)
  ind.set_status (appindicator.STATUS_ACTIVE)
  
  menu = gtk.Menu()
  ind.set_menu(menu)
  
  glib.timeout_add_seconds(2, refresh)
  gtk.main()

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/717529

Title:
  Large memory leak each time set_menu is used

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to