gtk-window-decorator leaking window handles. Window operations become sluggish after a few days of usage

Bug #1050610 reported by Steve Magoun on 2012-09-13
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Sam Spilsbury
Compiz Core
Sam Spilsbury
compiz (Ubuntu)
Sam Spilsbury
Sam Spilsbury

Bug Description


Memory leaking causing user visible problems like performance degradation.

[Test Case]

GTK-Window-Decorator Resource Usage
Sam Spilsbury <email address hidden>

XRestop usage
#. Install xrestop (sudo apt-get install xrestop)
#. Run xrestop (eg, $ xrestop &)
#. Note the number in the "Wns" column for gtk-window-decorator
#. Open a window
#. Close that window
#. The number should be the same

[Regression Potential]

Low, has been well tested in Ubuntu 12.10.

--- original bug report ---

gtk-window-decorator appears to be leaking window handles when windows are opened. The leak(s) correspond with performance degradation over time, especially on systems with relatively low amounts of VRAM (I have 256MB).

User-visible symptoms include:
* Performance degradation over time
* Sluggish animations, such as when using Super-W and Super-S
* When switching windows, window contents briefly drawn as black rectangles before being rendered correctly
* Window decorations not drawn on new windows

To reproduce:
1) install xrestop ("apt-get install xrestop")
2) In a terminal, launch xrestop. Keep it running, and observe the number of 'Wins' and amount of pixmam memory ('Pxm mem') associated with the gtk-window-decorator process
3) Open a new terminal (or any other) window. Observe that the number of windows had gone up by some amount. Opening a terminal window reliably results in exactly 19 extra window handles on my system.
4) Close the window

Expected results:
Per xrestop, the number of window handles goes down when you close the window. (Are some of the handles are related to window-open animation? In that case I'd expect them to be disposed of when the animation is complete)

Actual results:
Per xrestop, the number of window handles remains the same when you close the window.

I also observed that the total pixmap memory used by gtk-window-decorator steadily climbs over time. While closing a window does appear to release some pixmap memory, it does not seem to release all of it. Performace on my system with 256MB VRAM got really bad when the number of window handles in gtk-window-decorator climbed above 7000 and the total pixmap memory used by gtk-window-decorator was about 75MB.

Killing + restarting gtk-window-decorator temporarily solves the problem.

xrestop output:

xrestop - Display: localhost
          Monitoring 32 clients. XErrors: 7
          Pixmaps: 169216K total, Other: 672K total, All: 169889K total

res-base Wins GCs Fnts Pxms Misc Pxm mem Other Total PID Identifier
2600000 7176 67 1 495 724 78983K 187K 79171K 2359 gtk-window-dec
0c00000 1292 2 1 112 15364 57130K 391K 57521K ? Compiz

top output:

 1306 root 20 0 573m 461m 6364 R 105.5 11.7 357:52.15 Xorg

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: compiz-gnome 1:
ProcVersionSignature: Ubuntu 3.5.0-14.15-generic 3.5.3
Uname: Linux 3.5.0-14-generic x86_64
NonfreeKernelModules: nvidia
.proc.driver.nvidia.gpus.0: Error: [Errno 21] Is a directory: '/proc/driver/nvidia/gpus/0'
.proc.driver.nvidia.registry: Binary: ""
 NVRM version: NVIDIA UNIX x86_64 Kernel Module 304.43 Sun Aug 19 20:14:03 PDT 2012
 GCC version: gcc version 4.7.1 20120908 (prerelease) (Ubuntu/Linaro 4.7.1-8ubuntu1)
 Your system is not currently configured to drive a VGA console
 on the primary VGA device. The NVIDIA Linux graphics driver
 requires the use of a text-mode VGA console. Use of other console
 drivers including, but not limited to, vesafb, may result in
 corruption and stability problems, and is not supported.
ApportVersion: 2.5.1-0ubuntu7
Architecture: amd64
CompizPlugins: No value set for `/apps/compiz-1/general/screen0/options/active_plugins'
Date: Thu Sep 13 16:16:08 2012
DistUpgraded: 2012-08-07 11:19:37,876 DEBUG enabling apt cron job
DistroCodename: quantal
DistroVariant: ubuntu
 nvidia-current, 304.43, 3.5.0-13-generic, x86_64: installed
 nvidia-current, 304.43, 3.5.0-14-generic, x86_64: installed
 virtualbox, 4.1.18, 3.5.0-13-generic, x86_64: installed
 virtualbox, 4.1.18, 3.5.0-14-generic, x86_64: installed
 NVIDIA Corporation G84 [GeForce 8600M GT] [10de:0407] (rev a1) (prog-if 00 [VGA controller])
   Subsystem: Apple Inc. Device [106b:00a0]
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Beta amd64 (20100901.1)
 kmod:nvidia_current_updates - NVIDIA binary Xorg driver, kernel module and VDPAU library (Proprietary, Disabled, Not in use)
 kmod:nvidia_current - nvidia_current (Proprietary, Enabled, Not in use)
 kmod:nvidia_173_updates - NVIDIA binary Xorg driver, kernel module and VDPAU library (Proprietary, Disabled, Not in use)
 kmod:nvidia_173 - NVIDIA binary Xorg driver, kernel module and VDPAU library (Proprietary, Disabled, Not in use)
MachineType: Apple Inc. MacBookPro3,1
 PATH=(custom, no user)
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.5.0-14-generic root=UUID=4b3d81ed-fb5d-4946-97c0-ec537e1bfa3f ro quiet splash vt.handoff=7
SourcePackage: compiz
UpgradeStatus: Upgraded to quantal on 2012-08-07 (37 days ago) 03/05/08
dmi.bios.vendor: Apple Inc.
dmi.bios.version: MBP31.88Z.0070.B07.0803051658
dmi.board.asset.tag: Base Board Asset Tag Mac-F4238BC8
dmi.board.vendor: Apple Inc.
dmi.board.version: PVT
dmi.chassis.asset.tag: Asset Tag#
dmi.chassis.type: 2
dmi.chassis.vendor: Apple Inc.
dmi.chassis.version: Mac-F4238BC8
dmi.modalias: dmi:bvnAppleInc.:bvrMBP31.88Z.0070.B07.0803051658:bd03/05/08:svnAppleInc.:pnMacBookPro3,1:pvr1.0:rvnAppleInc.:rnMac-F4238BC8:rvrPVT:cvnAppleInc.:ct2:cvrMac-F4238BC8: MacBookPro3,1
dmi.product.version: 1.0
dmi.sys.vendor: Apple Inc.
version.compiz: compiz 1:
version.ia32-libs: ia32-libs N/A
version.libdrm2: libdrm2 2.4.39-0ubuntu1
version.libgl1-mesa-dri: libgl1-mesa-dri
version.libgl1-mesa-dri-experimental: libgl1-mesa-dri-experimental N/A
version.libgl1-mesa-glx: libgl1-mesa-glx
version.nvidia-graphics-drivers: nvidia-graphics-drivers N/A
version.xserver-xorg-core: xserver-xorg-core 2:1.13.0-0ubuntu1
version.xserver-xorg-input-evdev: xserver-xorg-input-evdev 1:2.7.3-0ubuntu1
version.xserver-xorg-video-ati: xserver-xorg-video-ati 1:6.99.99~git20120713.6ef1ad6a-0ubuntu1
version.xserver-xorg-video-intel: xserver-xorg-video-intel 2:2.20.7-0ubuntu1
version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau 1:1.0.2-0ubuntu1

Related branches

Steve Magoun (smagoun) wrote :
Omer Akram (om26er) on 2012-09-13
Changed in compiz:
importance: Undecided → High
Changed in compiz (Ubuntu):
importance: Undecided → High
Omer Akram (om26er) wrote :

I have attached the valgrind logs.

Changed in compiz:
status: New → Confirmed
Changed in compiz (Ubuntu Quantal):
status: New → Confirmed
tags: added: compiz-0.9
Omer Akram (om26er) on 2012-09-14
Changed in compiz:
milestone: none →
assignee: nobody → Sam Spilsbury (smspillaz)
Changed in compiz (Ubuntu Quantal):
assignee: nobody → Sam Spilsbury (smspillaz)
summary: - gtk-window-decorator leaking window handles
+ gtk-window-decorator leaking window handles. Window operations become
+ sluggish after a few days of usage
Changed in compiz:
status: Confirmed → In Progress
Changed in compiz-core:
status: New → Triaged
importance: Undecided → High
milestone: none →
milestone: →
Daniel van Vugt (vanvugt) wrote :

OK, the Window leak seems fixed by Sam's branch but the Pixmap leak (which looks worse) is still there. I've logged bug 1057263 to track the Pixmap leak.

Thanks Steve for you excellent work.

Daniel van Vugt (vanvugt) wrote :

Interestingly the window leak does not seem to be present in lp:compiz-core/0.9.7

The pixmap leak is, but that's now bug 1057263.

Changed in compiz-core:
status: Triaged → Invalid
milestone: → none
Changed in compiz:
status: In Progress → Fix Committed
Daniel van Vugt (vanvugt) wrote :

Fix committed into lp:compiz at revision 3398

Steve Magoun (smagoun) wrote :

@Daniel: I can reproduce the window handle leak in compiz on 12.04 using the steps in the original description.

Daniel van Vugt (vanvugt) wrote :

Thanks Steve.

I actually tested the latest lp:compiz-core/0.9.7, not Ubuntu 12.04. But we should double-check again. And the fix is probably easy to backport regardless.

Changed in compiz-core:
status: Invalid → Confirmed
milestone: none →
Changed in compiz:
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package compiz - 1:

compiz (1: quantal-proposed; urgency=low

  * debian/control:
    - Add dependency on gnome-settings-daemon for compiz-gnome, since some
      tests need the g-s-d gsetting schemas
  * New upstream release.
    - FTBFS with -DCOMPIZ_BUILD_TESTING=OFF if libgtest-dev is not installed
      (LP: #1057421)
    - [performance] glXSwapIntervalEXT called every frame, which is very slow
      on Nvidia. (LP: #1051286)
    - opacify plugin: opacity isn't reset after switching window (LP: #1050757)
    - cmake fails on python 2.6 as sys.version_info does not contain
      major_version or minor_version (LP: #1048964)
    - scale mode is not visible if a fullscreen window is unredirected
      (LP: #1047168)
    - Unredirected fullscreen windows flicker briefly when another window
      (like a menu) opens above them (LP: #1046664)
    - Week33 - Grid highlight window appears while switching between workspaces
      (LP: #1037142)
    - gtk-window-decorator leaks large numbers of pixmaps and pixmap memory
      (LP: #1057263)
    - [fglrx] compiz crashed with SIGSEGV in glXDestroyContext()
      [/usr/lib/fglrx/] from GLScreen::~GLScreen() (LP: #1054724)
    - Maximized window gets unredirected when it's not fullscreen
      (LP: #1053902)
    - Double shortcuts conflict with gnome-control-center ones (LP: #1050796)
    - gtk-window-decorator leaking window handles. Window operations become
      sluggish after a few days of usage (LP: #1050610)
    - [valgrind] Up to 520,000 bytes lost when running
      CCSGSettingsBackendConceptTest (LP: #1049169)
    - 1:0.9.8+bzr3319-0ubuntu1 regression: keeps setting gsettings keys to
      wrong values (LP: #1042041)
    - Compiz r3275 breaks VirtualBox Guest Additions: black screen or just
      wallpaper (LP: #1030891)
    - Incorrect (low/stuttering) refresh rate with NVIDIA driver (LP: #92599)
    - ARM build broken with 'swapInterval' is not a member of 'GL'
      (LP: #1056645)
    - compiz.fix_927168 broke ARM building (LP: #1052838)
    - compiz crashed with SIGSEGV in __strcasestr_ia32() from
      ccsStringToModifiers(binding=NULL) (LP: #1041535)
  * Cherry-picked from upstream:
    - ABI bump due to an ABI change in the composite plugin
    - Removed schema keys still used in keybindings and automated tests
      (LP: #1057955)
 -- Lukasz 'sil2100' Zemczak <email address hidden> Thu, 27 Sep 2012 15:43:59 +0200

Changed in compiz (Ubuntu Quantal):
status: Confirmed → Fix Released
Daniel van Vugt (vanvugt) wrote :

Fix committed to lp:compiz-core/0.9.7 at revision 3118.

Changed in compiz-core:
status: Confirmed → Fix Committed
assignee: nobody → Sam Spilsbury (smspillaz)
description: updated
Changed in compiz-core:
status: Fix Committed → Fix Released

Hello Steve, or anyone else affected,

Accepted compiz into precise-proposed. The package will build now and be available at in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at . Thank you in advance!

Changed in compiz (Ubuntu Precise):
status: New → Fix Committed
tags: added: verification-needed
Steve Magoun (smagoun) wrote :

I confirmed that compiz 1: fixes the leak.

tags: added: verification-done
removed: verification-needed

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package compiz - 1:

compiz (1: precise-proposed; urgency=low

  * New upstream stable branch snapshot.
    - Includes all the previous cherry-picked fixes
    - Fix crash when imgsvg is loaded, due to missing symbol
      (decor_apply_gravity from libdecoration). (LP: #956986)
    - Fix multiple window placement bugs (LP: #974242) (LP: #976032)
    - Fix window handle leak causing gradual degradation in desktop
      performance (LP: #1050610)
    - Some decoration pixmaps get leaked on window resize, due to race
      conditions between gtk-window-decorator and the decor plugin.
      (LP: #1057263)
    - Avoid a NULL dereference and give a useful error message instead.
      (LP: #944653)
    - Fix leakage of destroyed_pixmaps_table, containing pointers to freed
      decor_t's which could result in a freed GHashTable being passed into
      g_hash_table_remove and causing a crash. (LP: #1060171)
  * debian/patches/compiz-package-gles2.patch:
    - Drop the NEWS file, update decor.cpp part to build with new upstream
  * debian/patches/revert_fix_933776_955035.patch:
    - Cherry-pick the revert from upstream since the bug fix is not
      suitable for SRU as is
  * debian/patches/revert_fix_994841.patch:
    - Cherry-pick also this revert as non-SRU material, not relevant
      to users
  * debian/libdecoration0.symbols:
    - Update with latest symbols
 -- Timo Jyrinki <email address hidden> Mon, 12 Nov 2012 13:56:29 +0200

Changed in compiz (Ubuntu Precise):
status: Fix Committed → Fix Released
positivek (anonyhole) wrote :

Still present in 14.04.1 LTS trusty.

Please let me know if I can provide more information to help localize the problem.

To post a comment you must log in.