Xorg: heap leaking

Pavel Troller patrol at sinus.cz
Fri Jan 5 21:53:59 PST 2007

  There is definitely a large memory leak somewhere in the current X. Default
branch leaks as well as xserver-1.2-branch.
  Operating X for a longer time consumes more and more memory. After about 3
days I have to kill my X to return all the memory and start it again. I have
1 GB of memory.
  I did the following experiment:
  - Started X and logged in (into KDE)
  - Worked about 10 hrs (overnight) - at least 6 hours it run without any user
    activity, because I was sleeping :-)
  - Logged off KDE
  - recorded /proc/<n>/maps of X
  - Killed X
  - Started it again, logged in again
  - Did a typical activity once (opened a web page, played a video, run an
    OpenGL app)
  - Immediately logged off
  - recorded /proc/<n>/maps of X again
  - diffed them
  ... and there is the result:
--- maps1       2007-01-06 06:16:29.000000000 +0100
+++ maps2       2007-01-06 06:19:15.000000000 +0100
@@ -1,6 +1,6 @@
 00400000-00597000 r-xp 00000000 08:01 567000                             /opt64/X11/bin/Xorg
 00796000-007a8000 rw-p 00196000 08:01 567000                             /opt64/X11/bin/Xorg
-007a8000-12c1f000 rw-p 007a8000 00:00 0                                  [heap]
+007a8000-02682000 rw-p 007a8000 00:00 0                                  [heap]
 2aaaaaaab000-2aaaaaac8000 r-xp 00000000 08:01 531306                     /lib64/ld-2.5.so
 2aaaaaac8000-2aaaaaac9000 rw-p 2aaaaaac8000 00:00 0
 2aaaaaaf5000-2aaaaaaf6000 rw-p 2aaaaaaf5000 00:00 0
@@ -124,5 +124,5 @@
 2aaabedb2000-2aaabefb1000 ---p 00226000 08:01 588378                     /opt64/X11/lib/xorg/modules/extensions/libGLcore.so
 2aaabefb1000-2aaabefc8000 rw-p 00225000 08:01 588378                     /opt64/X11/lib/xorg/modules/extensions/libGLcore.so
 2aaabefc8000-2aaabefd3000 rw-p 2aaabefc8000 00:00 0
-7fff69b21000-7fff69c52000 rw-p 7fff69b21000 00:00 0                      [stack]
+7fff497f0000-7fff49805000 rw-p 7fff497f0000 00:00 0                      [stack]
 ffffffffff600000-ffffffffffe00000 ---p 00000000 00:00 0                  [vdso]
  It's visible that the first case has much more heap memory allocated. The
difference is over 256MB, and it's just 10 hours. It's the only difference
(excluding random stack placement).
  IMHO the amount of heap should be approximately the same (we are in the same
situation, all the X clients have terminated except kdm so there is no need for
such a big difference).
  I searched bugzilla for "xserver memory leak" but there are 200 bugs listed,
which I didn't examine too closely but none of them seems to be exactly
pointing out my problem.
  It doesn't happen with 6.9.0.
  Any hints, how to help to debug, or what to do next ?
           With regards, Pavel Troller

More information about the xorg mailing list