[sugar] Memory leaks summary

Marco Pesenti Gritti mpgritti
Thu Sep 11 21:31:15 EDT 2008


Hello,

here is a summary of what we know so far about the memory leaks
related to network activity (buddies joining/leaving).

1 We was leaking the palette that we create for each buddy. Tomeu
fixed it, should be in the next stable build.

2 We are still leaking the palette icons. It should not be too hard to
track that down. Failing that we can make the palette lazy to work
around the problem for 8.2.0. It's something we should be doing anyway
to save memory and cpu.

3 If I disable the palette completely I still get some leaking. I'm
using a script that continuously create and destroy 10  buddies. Here
is typical relative memory consumption reported by guppy (running it
in a loop of 5 seconds). Note that I completely disabled the sugar
shell model and view before taking this data.

Partition of a set of 1108 objects. Total size = 104160 bytes.
 Index  Count   %     Size   % Cumulative  % Kind (class / dict of class)
     0    174  16    23664  23     23664  23 dict (no owner)
     1     82   7    15144  15     38808  37 str
     2     50   5    10680  10     49488  48 unicode
     3    120  11     7920   8     57408  55 dbus.String
     4     80   7     7360   7     64768  62 dbus.connection.SignalMatch
     5     10   1     5280   5     70048  67 dbus.Dictionary
     6     10   1     5200   5     75248  72 dict of 0x94254cc
     7     10   1     5200   5     80448  77 dict of dbus.proxies.ProxyObject
     8     80   7     4480   4     84928  82 function
     9     91   8     4448   4     89376  86 list
<16 more rows. Type e.g. '_.more' to view.>

Does that mean we have a leak in sugar.presence?

The code I'm using:

diff --git a/src/main.py b/src/main.py
index 1ccfbb8..3ab0e52 100644
--- a/src/main.py
+++ b/src/main.py
@@ -79,8 +79,17 @@ def _software_update_cb():
     home_box = shell.home_window.get_home_box()
     home_box.show_software_updates_alert()

+import guppy
+heapy = guppy.hpy()
+
+def _heapy_cb():
+    print heapy.heap()
+    heapy.setref()
+    return True
+
 def main():
     gobject.idle_add(_shell_started_cb)
+    gobject.timeout_add(5000, _heapy_cb)

     try:
         logsmanager.setup()

4) The grid layout is leaking objects when collision solving fails
(i.e. you have a very full mesh view). We are probably not hitting
this case in testing, but still should be fixed.

Marco



More information about the Sugar-devel mailing list