Compiz uses increasingly large amounts of memory

Bug #755863 reported by Abhishek Udupa
82
This bug affects 23 people
Affects Status Importance Assigned to Milestone
compiz (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: compiz

Compiz on natty (beta 1, amd64, with all the latest updates) uses up increasingly large amounts of memory. It starts off with 10 - 20 MB resident on boot, but continually keeps growing. Right now, with an uptime of about five hours, I see it using about 200 MB of resident memory. Previously, with an uptime of 1 day, it was using upto 500 MB in resident memory. I'm using a Dell XPS L502X with a quad-core Sandybridge with the nouveau module blacklisted (since it doesn't support nvidia optimus), so I guess the Intel Sandybridge GPU is being used. I've only enabled the minimal set of compiz extensions (see attached unity.ini). Also, I'm running the classic ubuntu desktop rather than the unity desktop (having only 4 virtual desktops is a show-stopper for me). I'm not too sure about what other attachments I need to include, but I'd be happy to provide any more information that might be required to resolve this bug.

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: compiz 1:0.9.4+bzr20110407-0ubuntu2
ProcVersionSignature: Ubuntu 2.6.38-8.41-generic 2.6.38.2
Uname: Linux 2.6.38-8-generic x86_64
Architecture: amd64
CompizPlugins: [core,composite,opengl,compiztoolbox,decor,vpswitch,mousepoll,shift,place,staticswitcher,snap,wall,move,resize,regex,gnomecompat,animation,workarounds]
CompositorRunning: compiz
DRM.card0.DP.1:
 status: disconnected
 enabled: disabled
 dpms: Off
 modes:
 edid-base64:
DRM.card0.HDMI.A.1:
 status: disconnected
 enabled: disabled
 dpms: Off
 modes:
 edid-base64:
DRM.card0.LVDS.1:
 status: connected
 enabled: enabled
 dpms: On
 modes: 1920x1080
 edid-base64: AP///////wAGr+0XAAAAAAAUAQSQIhN4AiE1rVA3qiQRUFQAAAABAQEBAQEBAQEBAQEBAQEBeDeArnA4MkA8MKoAWMEQAAAaeDeArnA4MkA8MKoAWMEQAAAaAAAA/gBLWVlWS4BCMTU2SFcxAAAAAAAAgQKbAQEAAAIBCiAgAAE=
DRM.card0.VGA.1:
 status: disconnected
 enabled: disabled
 dpms: Off
 modes:
 edid-base64:
Date: Sat Apr 9 17:21:56 2011
DistUpgraded: Fresh install
DistroCodename: natty
DistroVariant: ubuntu
GraphicsCard:
 Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0126] (rev 09) (prog-if 00 [VGA controller])
   Subsystem: Dell Device [1028:050e]
 nVidia Corporation Device [10de:0df4] (rev a1) (prog-if 00 [VGA controller])
   Subsystem: Dell Device [1028:050e]
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Beta amd64 (20110330)
InstallationMedia_: Ubuntu 11.04 "Natty Narwhal" - Beta amd64 (20110330)
MachineType: Dell Inc. Dell System XPS L502X
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=en_US:en
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/usr/bin/zsh
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-2.6.38-8-generic root=UUID=da3a2119-1dbd-4f7d-a4be-3b3c3cb5584c ro quiet splash usbcore.autosuspend=-1 vt.handoff=7
ProcVersionSignature_: Ubuntu 2.6.38-8.41-generic 2.6.38.2
Renderer: Unknown
SourcePackage: compiz
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 03/25/2011
dmi.bios.vendor: Dell Inc.
dmi.bios.version: A04
dmi.board.name: 0NJT03
dmi.board.vendor: Dell Inc.
dmi.board.version: A00
dmi.chassis.type: 8
dmi.chassis.vendor: Dell Inc.
dmi.chassis.version: 0.1
dmi.modalias: dmi:bvnDellInc.:bvrA04:bd03/25/2011:svnDellInc.:pnDellSystemXPSL502X:pvr:rvnDellInc.:rn0NJT03:rvrA00:cvnDellInc.:ct8:cvr0.1:
dmi.product.name: Dell System XPS L502X
dmi.sys.vendor: Dell Inc.
version.compiz: compiz 1:0.9.4+bzr20110407-0ubuntu2
version.ia32-libs: ia32-libs 20090808ubuntu11
version.libdrm2: libdrm2 2.4.23-1ubuntu6
version.libgl1-mesa-dri: libgl1-mesa-dri 7.10.1-0ubuntu3
version.libgl1-mesa-dri-experimental: libgl1-mesa-dri-experimental N/A
version.libgl1-mesa-glx: libgl1-mesa-glx 7.10.1-0ubuntu3
version.xserver-xorg: xserver-xorg 1:7.6+4ubuntu3
version.xserver-xorg-video-ati: xserver-xorg-video-ati 1:6.14.0-0ubuntu4
version.xserver-xorg-video-intel: xserver-xorg-video-intel 2:2.14.0-4ubuntu6
version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau 1:0.0.16+git20110107+b795ca6e-0ubuntu6

Revision history for this message
Abhishek Udupa (abhishek-udupa) wrote :
Revision history for this message
Brendan Edmonds (ziggyfish) wrote :

I can confirm this, at the moment my compiz is using 775.9 MB

Revision history for this message
Abhishek Udupa (abhishek-udupa) wrote :

An update: I reverted to the default settings in Compiz (by going preferences -> reset to default in ccsm). The only changes I made after this were:

1. Have 16 virtual desktops in a 4x4 tile
2. Assign shortcuts for switching between desktops
3. Disable window decorations for maximized windows (use the appmenu instead)
4. Change the keyboard shortcut for toggle window maximization state.

I still see this leak. Again, I'd really like to see this bug resolved and would be happy to do anything to help fix it.

Revision history for this message
Abhishek Udupa (abhishek-udupa) wrote :

Update #2:

I ran compiz under valgrind for about 25 minutes with:

G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind -v --tool=memcheck --leak-check=full --num-callers=40 --log-file=valgrind-compiz.log compiz --replace

The output is attached. I can't say for sure how much the resident memory usage of compiz increased in this amount of time since it was running under the valgrind process. But there seems to be about 10MB that has leaked from a call to XQueryTree in 1716 blocks.

Revision history for this message
Abhishek Udupa (abhishek-udupa) wrote :

I've narrowed it down to the PrivateScreen::syncStacks () function in src/screen.cpp. There's a call to XQueryTree there and the "children" variable which XQueryTree returns does not look like it escapes the function, nor is it freed. I've attached a patch that fixes it for me (2 hours of uptime with compiz memory usage steady at 21 MB).

I'm no compiz developer nor am I an X11 hacker, so I'm not sure of this is the right fix. Could the compiz package maintainers please validate the fix as well as pull in the patch?

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Re: [Compiz] [Bug 755863] Re: Compiz uses increasingly large amounts of memory

Ah, thanks for that! Patch applied.

For the other memory leaks, the best way to look into them is to do a
metacity --replace. This is the only way you can tear down all the
compiz stuff at runtime and should give you a better view of what's
going on.

On Mon, Apr 11, 2011 at 8:43 AM, Abhishek Udupa
<email address hidden> wrote:
> I've narrowed it down to the PrivateScreen::syncStacks () function in
> src/screen.cpp. There's a call to XQueryTree there and the "children"
> variable which XQueryTree returns does not look like it escapes the
> function, nor is it freed. I've attached a patch that fixes it for me (2
> hours of uptime with compiz memory usage steady at 21 MB).
>
> I'm no compiz developer nor am I an X11 hacker, so I'm not sure of this
> is the right fix. Could the compiz package maintainers please validate
> the fix as well as pull in the patch?
>
> ** Patch added: "Patch for the Compiz memory leak"
>   https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/755863/+attachment/2013293/+files/compiz.patch
>
> --
> You received this bug notification because you are a member of compiz
> packagers, which is subscribed to compiz in Ubuntu.
> https://bugs.launchpad.net/bugs/755863
>
> Title:
>  Compiz uses increasingly large amounts of memory
>
> _______________________________________________
> Mailing list: https://launchpad.net/~compiz
> Post to     : <email address hidden>
> Unsubscribe : https://launchpad.net/~compiz
> More help   : https://help.launchpad.net/ListHelp
>

--
Sam Spilsbury

Changed in compiz (Ubuntu):
status: New → In Progress
assignee: nobody → Abhishek Udupa (abhishek-udupa)
status: In Progress → New
Revision history for this message
Abhishek Udupa (abhishek-udupa) wrote :

I've created a PPA so people don't need to build the packages to test them. The packages are available at:

https://launchpad.net/~abhishek-udupa/+archive/compiz

Changed in compiz (Ubuntu):
assignee: Abhishek Udupa (abhishek-udupa) → nobody
Revision history for this message
Abhishek Udupa (abhishek-udupa) wrote :

And Sam Spilsbury, the rest of the leaks seem rather benign to me. They're leaks of relatively small amounts of memory, usually in one or a few blocks, which lead me to suspect that they're "one-off" leaks in that they're not happening repeatedly. I'll monitor the memory usage of compiz for a couple of days and if it still blows up, I'll look into those leaks. Thanks for confirming the fix though. I presume that it will be released in the official repositories in the near future?

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

It is being released now. Thanks for your patch!

On Mon, Apr 11, 2011 at 10:39 AM, Abhishek Udupa
<email address hidden> wrote:
> And Sam Spilsbury, the rest of the leaks seem rather benign to me.
> They're leaks of relatively small amounts of memory, usually in one or a
> few blocks, which lead me to suspect that they're "one-off" leaks in
> that they're not happening repeatedly. I'll monitor the memory usage of
> compiz for a couple of days and if it still blows up, I'll look into
> those leaks. Thanks for confirming the fix though. I presume that it
> will be released in the official repositories in the near future?
>
> --
> You received this bug notification because you are a member of compiz
> packagers, which is subscribed to compiz in Ubuntu.
> https://bugs.launchpad.net/bugs/755863
>
> Title:
>  Compiz uses increasingly large amounts of memory
>
> _______________________________________________
> Mailing list: https://launchpad.net/~compiz
> Post to     : <email address hidden>
> Unsubscribe : https://launchpad.net/~compiz
> More help   : https://help.launchpad.net/ListHelp
>

--
Sam Spilsbury

Changed in compiz (Ubuntu):
status: New → Fix Released
Revision history for this message
_aleksandar_ (aca-deactivatedaccount) wrote :

Respected,

I still have a problem with compiz. He still spends a lot of memory. My system is up to date. Ubuntu 11.04 64-bit Unity. I leave a few out in the atached. I would ask you to consider this issue. Thanks in advance.

Aleksandar

Revision history for this message
Alfred (alfred-egger) wrote :

The problem still exists in Natty 11.04 AMD64 if Unity is running. After a few hours/days, Compiz takes up to 1.1 GiB of memory on a fully updated system.

Revision history for this message
Gorka Navarrete (emrys) wrote :

The bug is not solved as Compiz memory stills goes up significantly over time. There is a funny correlation I found between using the hot corners to minimize to desktop and an increase in the memory used by Compiz.

To replicate:

1. open System Monitor / Processes
unity --replace (to have a baseline, in my case, compiz goes down to 61.8 MiB or so)
go to the "show Desktop" hot corner a few times and see how the memory increases 0.2 MiB every couple times

Using the hot corner to "show all windows" does not have the same effect. It seems that using the keyboard shortcut to "show desktop" does not have the same effect.

Revision history for this message
Alfred (alfred-egger) wrote :

The bug is nowhere near solved. Just for testing I left a Natty 11.04 AMD64 machine untouched (not doing anything as a user) after booting and compiz takes up to 2.5 GiB of memory. As I said, no extra programs were started, no user action was taken, no effects were started either.

Revision history for this message
Alfred (alfred-egger) wrote :

I forget to add that it run only for a few hours (around 5) and the machine uses the nvidia-current driver.

Revision history for this message
David Raviv (davrav) wrote :

I can confirm that the problem still reproduces in Natty 11.04.
After 24h of moderate usage compiz consumes 565MB.
After resetting unity it goes down to 88.4MB (which is still high comparing to 10.10)

Please reopen.

Revision history for this message
Alfred (alfred-egger) wrote :

I am having the same problem on this perpetual beta called 11.04 "Final" with all updates installed. Compiz is now using 1,25 GiB memory after a few hours and steadily rising. This is a lot of memory on a machine running 4 GiB of memory, swapping is inevitable and makes the system really slow.

Reopen this bug.

Revision history for this message
Brendan Edmonds (bed88012) wrote :

I have been running 11.04 gnome with compiz for 40 days straight without reboot and have not had a problem. this must be out dated packages or some other issue.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.