13

On my desktop Xorg leaks a lot of memory. I use to let this machine on for days (weeks, months ...), but about once a week I'm forced to restart xorg, because it is taking too much memory.

Am I the only one affected by this issue? Why does this is happen?
Is it xorg to be bugged, or is it something else (maybe some xorg modules)?
Can I do anything to avoid it?


Some more infos:

I'm on ArchLinux, kernel 2.6.36, nvidia drivers 260.19.36, gnome 2.32.1.

Anyway I've got this issue from a lot of time, like more than one year.


Here is how the Xorg process is shown by top after about 9 days of uptime...

 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
1591 root      20   0  278m 229m 9364 S    2 11.8 244:38.73 Xorg

I've got only a few open windows. 229MB of resident memory looks like a lot to me (and it will keep growing with time). As soon as I reboot Xorg I'll also add process stats at the beginning of its life.


Here is as soon as my Gnome desktop gets up:

 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1573 root      20   0 89508  43m  11m S    1  2.2   0:03.53 Xorg
peoro
  • 3,778
  • @jsbillings: top shows that the process Xorg takes a lot of memory (like 300m) even if I close all X11 applications (but Gnome ones). – peoro Jan 27 '11 at 16:16
  • Does this problem happen with the non-proprietary drivers? – mattdm Feb 23 '11 at 19:50
  • And, does the Xorg memory usage grow, or does it start like that? – mattdm Feb 23 '11 at 19:51
  • @mattdm: I didn't test with non-proprietary drivers, since I need 3D graphic acceleration (with good performance!) every now and then. Xorg memory usage grows with time. – peoro Feb 23 '11 at 21:09
  • I would suggest trying the open source driver to see if the problem exists there. That will narrow down the issue. If the proprietary driver is to blame, only nvidia can help you. – mattdm Feb 23 '11 at 21:10
  • @mattdm: well, that's a nice idea... Ok, will switch to OSS driver next time I'll have to restart Xorg. – peoro Feb 23 '11 at 21:15
  • The output of xrestop may be helpful. – ninjalj Mar 06 '11 at 14:10
  • @ninjalj: Ok, I just installed xrestop. Will attach its output as soon as Xorg starts getting heavy. – peoro Mar 11 '11 at 13:21
  • Every incarnations and incantions of X have leaked since ever. It is not a bug, it is a feature – Rui F Ribeiro Aug 19 '17 at 15:06

4 Answers4

9

Some memory leaks in the X server are applications' faults; if they create server-side Pixmaps and don't clean up after themselves, they stick around forever. (This is intended to be a feature, so e.g. GNOME could install a set of standard Pixmaps once and then use them from any program by passing around their XIDs, as an optimization.) xrestop can be used to track these down.

geekosaur
  • 32,047
  • 1
    Are there other resources that xrestop won't show? Right now, xrestop shows me 45990K total, while top shows X with 11.9g RES (12.4g VIRT). That's a much bigger difference than I would expect... – aij Jun 06 '18 at 14:59
1

Here is an Ubuntu bug report for a memory leak in Xorg: https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/565981

Does that help at all?

Justin Ethier
  • 16,806
0

I have that same problem and similar OS. Mem leaks is probably in gnome. I have huge mem leaks in Xorg mem space when I use applet to change monitor resolution. I dont know where is problem but if you will disable this applet than mem leaks will not appear any more.

-2

I'm new to this, here's what I do to circumvent the problem:

  1. I switch to master console with Ctrl-Alt-F3
  2. logon as administrator
  3. type:

    exit
    
  4. switch back to desktop with Ctrl-Alt-F2

    All of the blocked memory has been released as if system was just booted.

I'm using tails 3.1