Hacker News new | ask | show | jobs
by exikyut 2337 days ago
I cannot believe those numbers. I've never known X to use 800KB of RAM.

IIUC it needs to hold at own one screen-sized framebuffer in memory, which is ~5MB on my system.

Practically speaking Xorg right now is using 460MB of virtual memory, 39MB resident, and 22MB shared (and that's _without_ Chromium running, ha).

And i3 is using 56MB virtual, 33MB resident, 32MB shared.

Also, for reference, "sleep infinity" uses 2324K virtual, 704K resident, and 640K shared. You might be able to beat that by working entirely in assembly language and using hair-raising allocation tricks like using the few KB of stackspace kernel gives you as your heap...? I'm not sure.

2 comments

Won't the screen-framebuffer be on gpu? Also, virtual memory shouldn't really matter.

Anyway:

    $ ps aux|egrep -i '(xorg|fvwm)'|awk -c '{print $2}'|xargs sudo pmap -x|grep 'total kB'
    total kB          808332  124808   86204
    total kB           64920   15724    2984
    total kB           61656   14428    2400
> Won't the screen-framebuffer be on gpu?

Not in X11. The front buffer needs to be in memory because it gets populated on-the-fly from windows via the Expose event, and the processes that those windows belong to need to be able to draw to it as a result. The protocol was also designed before there was any modern concept of "GPU memory", and couldn't assume the presence of anything more than very primitive 2D drawing hardware.

Another thing that can cause some extra memory use is applications caching pixmaps in the X server. X11 lets you register pixmaps server-side so that they don't have to be repeatedly transmitted across a network. This is great for X forwarding over networks, but largely unnecessary on modern hardware where both the server and clients reside on the same machine, and can cause the server's memory usage to balloon, especially with applications like web browsers.

That's 800 MB, not kB. Even the smallest process in your example is 14 MB.
OpenBSD:

SIZE RES

47M 41MB Xorg

2324K 9328K cwm