You are not logged in.

#1 2023-07-10 21:42:08

blah123213
Member
Registered: 2022-04-28
Posts: 19

Xorg using a lot of memory

I use DWM and such, and I used to have a pretty nimble system when I didnt have anything open.  When I open htop, I currently have approximately 1.2 gigs just for that alone(RES column) with Xorg, it wasn't always this way, when idle I could usually be below 1 gig.

I tried the following, and it helped alleviate the worst aspects of it, because I was at approximately 10 gigs with nothing more than firefox open:

sudo sysctl vm.drop_caches=3

I am not really sure what else it could be. I did try installing libre-office, and it messed a bunch of things up and then I eventually uninstalled it. the system is essentially working but the ram use is just way too high and I would like it to go back to what it was.

Are there any additional things I can look at? With firefox open I am currently at 3 gigs. Thats the only application I have open. I'd like to get back to under 1 gig when I have nothing open. Is there some setting in xorg that could be causing this?

Last edited by blah123213 (2023-07-10 21:51:46)

Offline

#2 2023-07-10 21:57:39

teckk
Member
Registered: 2013-02-21
Posts: 562

Re: Xorg using a lot of memory

Is there some setting in xorg that could be causing this?

Yes I think so. Xorg for about a year now holds on to pixmaps and does not release them. Over time xorg RAM usage creeps up. All of my arch machines with intel graphics, modeset driver, do that. Dual core, 3rd, 4th Gen intels. Every 3 or 4 days I back out of X and restart.

X with fluxbox starts out at 130MB or so used by xorg. In 3 or 4 days it will 4GB.

There has been several thread on this board about it.

Dropping caches only drops what isn't being used by something.

Offline

#3 2023-07-11 06:43:30

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 70,981

Re: Xorg using a lot of memory

Clients can create server-side pixmaps that they'll have to [Edit: wtf cleap up "clean up"] or they'll stay forever.
Does xrestop indicate the source for the memory waste?

Last edited by seth (2023-07-11 12:31:46)

Offline

#4 2023-07-11 12:15:05

teckk
Member
Registered: 2013-02-21
Posts: 562

Re: Xorg using a lot of memory

No, not really. With only fluxbox, gkrellm, geany, xterm running xrestop.

0400000   202   21    1  471    0  401    24595K     15K  24611K 65409 Fluxbox
0000000     1    0    2    0    0   82     4050K      3K   4053K 112898 <unknown>
0800000     0    0    0    1    0    0     4050K      0B   4050K 65450 <unknown>
0600000     5   34    0  309    2   55     3062K      2K   3064K 74282 gkrellm
1400000    10   58    1    4    3   48      392K      3K    396K 92866 ~/c/xrestop/
1800000     8    3    1    8    1   50      268K      2K    270K 112898 *untitled - G
0c00000     0    1    0    0    0    2        0B     72B     72B 65502 <unknown>
0a00000     1    1    0    0    0    0        0B     48B     48B 112935 xrestop
0200000     0    1    0    0    0    0        0B     24B     24B 65402 <unknown>

Got fluxbox, geany, gkrellm, xterm, rox open.

ps aux  | awk '{print $6/1024 " MB\t\t" $11}'  | sort -n

...
2.33594 MB              xinit
3.03906 MB              -bash
3.07031 MB              /usr/bin/pipewire
3.125 MB                sort
3.19531 MB              (sd-pam)
3.30469 MB              /usr/lib/dconf-service
3.375 MB                ps
3.53125 MB              /usr/lib/at-spi-bus-launcher
4.17188 MB              /bin/sh
4.375 MB                bash
4.39062 MB              /usr/lib/systemd/systemd-logind
4.91406 MB              /usr/lib/systemd/systemd-udevd
6.74609 MB              /usr/lib/systemd/systemd
7.98828 MB              /usr/lib/at-spi2-registryd
8.66797 MB              /sbin/init
14.8906 MB              /usr/lib/systemd/systemd-journald
15.2969 MB              fluxbox
17.6602 MB              xterm
22.0703 MB              dirmngr
25.4414 MB              gkrellm
38.1836 MB              /usr/share/ROX-Filer/ROX-Filer
51.8438 MB              geany
1581.76 MB              /usr/lib/Xorg

Offline

#5 2023-07-11 12:33:16

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 70,981

Re: Xorg using a lot of memory

Can you test whether it leaks w/ xf86-video-intel ?

Offline

#6 2023-07-12 00:31:28

blah123213
Member
Registered: 2022-04-28
Posts: 19

Re: Xorg using a lot of memory

I ended up trying out xrestop, never heard of it before, wish I did though. Turns out picom is the culprit. Not terribly unexpected but it never had this problem in the past.

I killed picom and my memory immediately went from 5 gb to 2.5 gb, which makes more sense considering what I have open. I'll still use picom but ill keep it off most of the time

Offline

#7 2023-07-12 06:08:17

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 70,981

Re: Xorg using a lot of memory

You should probably file an upstream bug against picom and feel free to post your picom config (assuming you're not using the defaults)

I'll still use picom but ill keep it off most of the time

As a nasty workaround, you could also frequently restart it.

Offline

#8 2025-09-26 15:52:29

teckk
Member
Registered: 2013-02-21
Posts: 562

Re: Xorg using a lot of memory

I found the answer to this for me. I did not want to use xf86-video-intel. You'll have to use mesa-amber, and the performance is not great.

This:

/etc/xorg.conf

Section "Serverflags"
    Option "Xinerama" "false"
Endsection

And X no longer eats RAM over time. RAM usage increases as one uses software, the way that you would expect. Close the software, and the RAM is released.

I'm on a little 17 year old intel dual core machine. 4GB of RAM.

I have geany, my own qtwebengine browser opened to this page, xterm, rox-filer, gkrellm, claws-mail, sqlitebrowser with a database, open. And xorg running for a couple of days.

free -m
               total        used        free      shared  buff/cache   available
Mem:            3809         858        1921         158        1457        2951
Swap:              0           0           0

Let me close everything except for an xterm.

free -m
               total        used        free      shared  buff/cache   available
Mem:            3809         473        2304          39        1340        3336
Swap:              0           0           0

That's the way that it is suppose to work. libxinerama makes X eat RAM.

Even with fluxbox, web-browser, terminal, gkrellm, email-client, rox-filer opened up.

ps aux  | awk '{print $6/1024 " MB\t\t" $11}'  | grep 'Xorg'
188.207 MB              /usr/lib/Xorg

Offline

#9 2025-09-26 18:08:03

topcat01
Member
Registered: 2019-09-17
Posts: 255

Re: Xorg using a lot of memory

https://man.archlinux.org/man/xorg.conf.5.en#Option~15
xinerama should be disabled by default.

Offline

#10 2025-09-26 18:56:02

teckk
Member
Registered: 2013-02-21
Posts: 562

Re: Xorg using a lot of memory

That's interesting.

I looked at fluxbox after you said that.
https://gitlab.archlinux.org/archlinux/ … type=heads

So it's fluxbox that has been causing me that Xorg leak.

Offline

#11 2025-09-26 19:05:50

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 70,981

Re: Xorg using a lot of memory

Section "Serverflags"
    Option "Xinerama" "false"
Endsection

is supposed to be effectively idempotent, but it might influence whether the extension is loaded.
Please post an xorg log w/ and w/o that config as well as then the output of "xdpyinfo | head -n64" and "xrandr -q" in either case?
(If xinerama is active, xrandr would fail)

Offline

#12 2025-11-06 15:38:01

teckk
Member
Registered: 2013-02-21
Posts: 562

Re: Xorg using a lot of memory

Follow up.

For anyone else who has a "xorg eat ram" problem.

I have this in my /etc/xorg.conf

Section "Extensions"
    Option "MIT-SHM" "disable" 
EndSection

Section "Serverflags"
    Option "Xinerama" "false"
Endsection

I have had xorg running with fluxbox for 5 days as you can see. I have had browsers, email clients, sqlitebrowser, libreoffice, coding with geany, terminals, file managers, my own yt browser, yt-dlp, mpv, etc. etc. open and closed. Xorg is only using 102M. I have not backed out of X. 5 days worth.

Little gtk3-cairo clock running and conky.
https://0x0.st/K9Z3.png

Only 1 monitor on this little machine. Everything works. If that conf makes a problem, I have not found it.

(Little meager dell optiplex 380 from 2008)

Edit:
And it has been a problem. This thread has over 5100 views at this time. Means that "they" are looking and finding this thread with a search engine, because of the problem. Not an Arch problem. An Xorg, Xinerama, and software that uses it problem.

Last edited by teckk (2025-11-06 16:15:28)

Offline

#13 2025-11-07 16:29:32

Valso
Member
Registered: 2021-04-22
Posts: 123

Re: Xorg using a lot of memory

blah123213 wrote:

Are there any additional things I can look at?

Yes, there are. This high RAM useage is because of a function in the kernel that is supposed to help but instead it causes a lot of problems, like not freeing unused RAM. I solved that problem with this string on the linux line in grub.cfg (if you edit grub.cfg directly, you don't need to run grub-update after that, just reboot).

transparent_hugepage=never

In some distros you have to do additional stuff, but in Arch's case only adding this to the linux line (and then reboot) was enough:
https://i.imgur.com/NuR2HNY.png


RADO OS GTK3 (customized Arch), i7-12700F, RTX 3070 Ti 8GB, 64GB DDR5-4800 (OCed to 5200 MHz).

Offline

Board footer

Powered by FluxBB