← Back to team overview

tiomap-dev team mailing list archive

[Bug 569273] Re: memory leak in gnome-power-manager

 

I have looked into this and have a fix and an explanation.  First,
please be mindful of this bugs many subscribers before following up with
non-technical comments.

The bug appears to be in libappindicator itself.  The call to
app_indicator_set_menu leaks the old menu every time a new menu is
passed in.  It should instead sink any floating ref on the old menu than
just unconditionally adding a new reference (see [1] for technical
details on what the heck that means).

There's actually two possible ways to fix this.  (A) change
libappindicator to sink the ref, which would arguably be an API change.
Or (B) change gnome-power-manager to manually unref the menu after
passing it to libappindicator.  I'm going with (A) for now and have
filed a patch against libappindicator [2].

I suspect that even if method (A) is approved and merged for natty,
method (B) is most appropriate for any possible SRUs.

[1] http://library.gnome.org/devel/gobject/stable/gobject-The-Base-Object-Type.html#floating-ref
[2] https://code.launchpad.net/~mterry/libappindicator/fix-menu-leak/+merge/53247

-- 
You received this bug notification because you are a member of TI OMAP
Developers, which is a direct subscriber.
https://bugs.launchpad.net/bugs/569273

Title:
  memory leak in gnome-power-manager

Status in Application Indicators:
  Fix Released
Status in “gnome-power-manager” package in Ubuntu:
  Invalid
Status in “indicator-application” package in Ubuntu:
  Fix Released
Status in “gnome-power-manager” source package in Lucid:
  Invalid
Status in “indicator-application” source package in Lucid:
  Triaged
Status in “gnome-power-manager” source package in Maverick:
  Confirmed
Status in “indicator-application” source package in Maverick:
  Confirmed

Bug description:
  TEST CASE: (at the beginning because it's a long post):
  1. Monitor the output of the command for a few hours 
    $ watch -n1 'grep heap -A11 /proc/$( pidof gnome-power-manager )/smaps'

  VERIFICATION SUCCEEDED:
  - Memory usage is stable over time

  
  DESCRIPTION:
  Binary package hint: gnome-power-manager

  gnome-power-manager (2.30.0-0ubuntu1) seems to have a memory leak my
  machine running Lucid.  I witnessed it using up to 120MB in the RES
  column according to "top".  My machine is 64 bit and is connected to a
  APC uninterruptible power supply.  I haven't yet tried unplugging it
  to see if the UPS is somehow related to this problem.  Another person
  reported a similar problem in bug #196688 comment 25.  Opening a new
  bug seemed like a good idea since that bug was fixed 2 years ago.

  Here is some information for what gnome-power-manager looks like after running for a long period of time (from  /proc/`pidof gnome-power-manager`/smaps):
  0147b000-08810000 rw-p 00000000 00:00 0                                  [heap]
  Size:             118356 kB
  Rss:              118188 kB
  Pss:              118188 kB
  Shared_Clean:          0 kB
  Shared_Dirty:          0 kB
  Private_Clean:         0 kB
  Private_Dirty:    118188 kB
  Referenced:       118020 kB
  Swap:                  0 kB
  KernelPageSize:        4 kB
  MMUPageSize:           4 kB

  I rebooted my machine and let it sit at the login screen.  I logged via ssh and found that gnome-power-manager was using the following:
  01f6e000-02075000 rw-p 00000000 00:00 0                                  [heap]
  Size:               1052 kB
  Rss:                 944 kB
  Pss:                 944 kB
  Shared_Clean:          0 kB
  Shared_Dirty:          0 kB
  Private_Clean:         0 kB
  Private_Dirty:       944 kB
  Referenced:          944 kB
  Swap:                  0 kB
  KernelPageSize:        4 kB
  MMUPageSize:           4 kB

  I logged out of my ssh session and didn't touch the machine until 5 and 1/2 hours later---and I logged in again remotely with ssh to check on gnome-power-manager and found:
  01f6e000-02e5d000 rw-p 00000000 00:00 0                                  [heap]
  Size:              15292 kB
  Rss:               15280 kB
  Pss:               15280 kB
  Shared_Clean:          0 kB
  Shared_Dirty:          0 kB
  Private_Clean:         0 kB
  Private_Dirty:     15280 kB
  Referenced:        15280 kB
  Swap:                  0 kB
  KernelPageSize:        4 kB
  MMUPageSize:           4 kB

  ProblemType: Bug
  DistroRelease: Ubuntu 10.04
  Package: gnome-power-manager 2.30.0-0ubuntu1
  ProcVersionSignature: Ubuntu 2.6.32-21.32-generic 2.6.32.11+drm33.2
  Uname: Linux 2.6.32-21-generic x86_64
  NonfreeKernelModules: nvidia
  Architecture: amd64
  Date: Fri Apr 23 22:23:32 2010
  GnomeSessionIdleInhibited: No
  GnomeSessionInhibitors: None
  GnomeSessionSuspendInhibited: No
  MachineType: DELL Inc. XPS 730X
  ProcCmdLine: BOOT_IMAGE=/boot/vmlinuz-2.6.32-21-generic root=UUID=e3f32a1f-7be3-45c9-9096-fa696ad50df3 ro quiet splash
  ProcEnviron:
   PATH=(custom, user)
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: gnome-power-manager
  dmi.bios.date: 07/16/2009
  dmi.bios.vendor: DELL INC.
  dmi.bios.version: 1.0.5
  dmi.board.name: 0P270J
  dmi.board.vendor: DELL Inc.
  dmi.board.version: A00
  dmi.chassis.type: 3
  dmi.chassis.vendor: DELL Inc.
  dmi.modalias: dmi:bvnDELLINC.:bvr1.0.5:bd07/16/2009:svnDELLInc.:pnXPS730X:pvr00:rvnDELLInc.:rn0P270J:rvrA00:cvnDELLInc.:ct3:cvr:
  dmi.product.name: XPS 730X
  dmi.product.version: 00
  dmi.sys.vendor: DELL Inc.