[winswitch] winswitch_applet memory usage

Antoine Martin antoine at nagafix.co.uk
Thu Sep 1 12:08:36 BST 2011

On 08/31/2011 01:09 AM, Ka-Hing Cheung wrote:
> On Tue, Aug 30, 2011 at 02:02, Antoine Martin <antoine at nagafix.co.uk> wrote:
>> On 08/30/2011 01:50 AM, Ka-Hing Cheung wrote:
>>> Over the weekend winswitch_applet grew to use 1.7GB of memory:
>> Whoa! That's a lot of memory! Something has definitely gone wrong there!
>> Can you tell us which OS and version (and anything else that might be
>> relevant) - could this be Ubuntu Lucid? (there are library bugs there)
> This is Ubuntu 10.10, winswitch version is 0.12.4-1. I have enough
> memory to keep this running for the rest of the week probably, so if
> there's anything you want me to do to live diagnose this, feel free to
> let me know.
I have fired up an Ubuntu 10.10 environment and found that it has the
same Python bugs as Ubuntu 10.04, namely that it leaks file descriptors
and the associated memory whenever we execute a command which fails.
I have applied a workaround for this, using another variant for spawning
external processes ("commands.getstatusoutput()").

I am unhappy about using this method as it is deprecated and provides
less debug information, but seeing that Ubuntu generally takes months to
fix bugs (and that's when the fix is provided..) - I guess everyone else
will have to suffer a little just so Ubuntu users suffer a little less..

This will work for recurring timers (taking screenshots and detecting
local sessions - which were the apparent cause of this leak) but not for
launching sessions... So I guess that it will continue to leak a little
bit of memory over time on buggy platforms, not much I can do about
that! The Windows and OSX installers include a bundled version of
Python, so these are not affected.
FYI: after running for days, the applet should not use more than 100M
resident memory, even with a few active sessions.

The fix is in trunk and I will try to release a new version today.


> Thanks
> -khc

PS: please always CC the list

More information about the shifter-users mailing list