Memory Usage by X

Andrew Clayton andrew at digital-domain.net
Sun Dec 10 08:27:39 PST 2006


On Sun, 10 Dec 2006 10:27:12 -0500, Ross Vandegrift wrote:

> On Sat, Dec 09, 2006 at 09:34:06PM +0000, Paulo J. Matos wrote:
> > Probably it can't get more because the rest is
> > distributed by the other apps. Worse, all mem and swap seem to be in
> > use:
> > $ free -m
> >             total       used       free     shared    buffers
> > cached Mem:          1011        993         18          0
> > 4         57 -/+ buffers/cache:        931         79
> > Swap:          494        494          0
> > 
> > Why is this? Is there any known leak in 7.1? Is this normal?
> 
> This is an age old point of confusion - Unix-like systems don't
> generally like leving memory free.  Free memory is wasted money - if
> you have the memory, you might as well do something useful with it.
> 
> One obvious thing you can do with it is cache disk reads and write to
> speed up the system.  You have 1GiB of memory and free is showing that
> your kernel has used 931MiB of that for buffer cache.  Your memory is
> not used because of X11 at all.  The kernel is caching data from disk.

I think your are misreading that.

The buffers/cache takes into account how much ram is being used for
buffers/cache so after that has been accounted for, he has 931MB used.

See the free in the first line is 18MB and the free in the second like
is 79MB (18+4+57) taking the buffers and cache into account.

Thus he is only using 61MB for buffers and cache. Some memory will
also be used up in the slab (slabtop can show how much), assuming he's
running Linux.

> Moreover, the swap is probably consumed because the kernel has chosen
> to swap out applications that you weren't using.  By doing this, it
> could make more room for caching disk access.
> 
> This is all confirmed by your explanation that you left some large
> compilation jobs running over night.  This means all of your user
> applications were idle, and so swapped to disk, and that gcc was
> eading lots and lots of different files that the kernel was caching.
> 
> You're seeing totally normal behavior that's just keeping your system
> running better!
> 

The X process does seem to grow overtime esp with extended use of
Firefox/Mozilla. Restarting them does free some up, also using things
like mplayer/xine seems to sometimes shrink the X process slightly.
Also he mentions he's using Konsole, I've seen Konsole use tons of
pixmap memory if you use a background image or use the fake
transparency.


Andrew



More information about the xorg mailing list