[Bugs] #4889 Sugar NORM: virtual memory leak in background control panel

Sugar Labs Bugs bugtracker-noreply at sugarlabs.org
Mon Oct 12 02:09:52 EDT 2015


#4889: virtual memory leak in background control panel
---------------------+-------------------------------
  Reporter:  quozl   |            Owner:
      Type:  defect  |           Status:  new
  Priority:  Normal  |        Milestone:  Unspecified
 Component:  Sugar   |          Version:  Unspecified
  Severity:  Minor   |       Resolution:
  Keywords:          |  Distribution/OS:  OLPC
Bug Status:  New     |
---------------------+-------------------------------

Comment (by SAMdroid):

 Testing on sugar-build.  I used a library python to view leaked objects
 [1].  I started the  SummaryTracker in the show_section_view function
 like:


 {{{
 diff --git a/src/jarabe/controlpanel/gui.py
 b/src/jarabe/controlpanel/gui.py
 index 442857d..8a51917 100644
 --- a/src/jarabe/controlpanel/gui.py
 +++ b/src/jarabe/controlpanel/gui.py
 @@ -31,6 +31,7 @@ from jarabe.controlpanel.toolbar import MainToolbar
  from jarabe.controlpanel.toolbar import SectionToolbar
  from jarabe import config
  from jarabe.model import shell
 +from pympler import tracker

  _logger = logging.getLogger('ControlPanel')

 @@ -193,7 +194,9 @@ class ControlPanel(Gtk.Window):
          if self._section_view is not None:
              self._section_view.destroy()
              self._section_view = None
 +            self._tr.print_diff()

 +        self._tr = tracker.SummaryTracker()
          self._set_toolbar(self._main_toolbar)
          self._main_toolbar.show()
          self._set_canvas(self._scrolledwindow)

 }}}

 Here are the outputs:

 {{{
                          types |   # objects |   total size
 ============================== | =========== | ============
                           list |        5343 |    543.05 KB
                            str |        5422 |    335.25 KB
                            int |         627 |     14.70 KB
                           code |          21 |      2.62 KB
                           dict |           1 |      2.52 KB
   <class 'gi.types.GObjectMeta |           2 |      1.77 KB
                          tuple |          12 |      1.14 KB
              method_descriptor |          12 |    864     B
                        weakref |           5 |    440     B
             wrapper_descriptor |           5 |    400     B
                function (undo) |           3 |    360     B
            function (__init__) |           2 |    240     B
              member_descriptor |           3 |    216     B
     function (do_get_property) |           1 |    120     B
     function (do_set_property) |           1 |    120     B
 }}}
 {{{
                                                     types |   # objects |
 total size
 ========================================================= | =========== |
 ============
                                                       set |           1 |
 232     B
                                                      code |           1 |
 128     B
                                     function (store_info) |           1 |
 120     B
                                                      cell |           2 |
 112     B
                                                     float |           1 |
 24     B
                                                      list |           0 |
 8     B
                                                       str |          -1 |
 -50     B
                                                     tuple |          -1 |
 -56     B
                  <class 'sugar3.graphics.icon._IconBuffer |          -1 |
 -64     B
                    <class 'pympler.tracker.SummaryTracker |          -1 |
 -64     B
                                                  instance |          -1 |
 -72     B
                     <class 'jarabe.model.buddy.BuddyModel |          -1 |
 -80     B
                   <class 'jarabe.view.buddyicon.BuddyIcon |          -1 |
 -80     B
   <class 'gi.repository.SugarGestures.LongPressController |          -1 |
 -80     B
       <class 'sugar3.graphics.palettewindow.CursorInvoker |          -1 |
 -80     B
 }}}
 {{{
                                 types |   # objects |   total size
 ===================================== | =========== | ============
                                  dict |          36 |     30.84 KB
                                   str |          48 |      8.90 KB
                        instancemethod |          92 |      7.19 KB
   <class 'dbus.connection.SignalMatch |          37 |      6.94 KB
                           dbus.String |          19 |      5.23 KB
                                  list |          29 |      2.59 KB
                                 tuple |          38 |      2.38 KB
                                  cell |          40 |      2.19 KB
                  function (signal_cb) |          17 |      1.99 KB
                   function (callback) |          17 |      1.99 KB
       <class 'dbus.bus.NameOwnerWatch |          17 |      1.06 KB
                       dbus.ObjectPath |           6 |    957     B
                                  long |          26 |    728     B
                        dbus.ByteArray |           2 |    662     B
                                   set |           0 |    512     B
 }}}
 {{{
                                 types |   # objects |   total size
 ===================================== | =========== | ============
                                   str |          46 |      8.64 KB
   <class 'dbus.connection.SignalMatch |          38 |      7.12 KB
                                  cell |          94 |      5.14 KB
                                  list |          44 |      3.40 KB
                  function (signal_cb) |          19 |      2.23 KB
                   function (callback) |          19 |      2.23 KB
          function (msg_reply_handler) |          15 |      1.76 KB
       <class 'dbus.bus.NameOwnerWatch |          19 |      1.19 KB
                       dbus.ObjectPath |           7 |   1014     B
                   function (error_cb) |           7 |    840     B
                     functools.partial |           6 |    528     B
             dbus.lowlevel.PendingCall |          22 |    528     B
                       dbus.UTF8String |          10 |    417     B
                                  code |           3 |    384     B
              <class 'threading._RLock |           5 |    320     B
 }}}

 At first appearence, most of these seem to come from the neighbour hood
 view.  I need to do a better test, but yeah.

 [1]  https://pythonhosted.org/Pympler/

--
Ticket URL: <https://bugs.sugarlabs.org/ticket/4889#comment:4>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list