added memory ...

Daniel Lawson daniel at wand.net.nz
Thu Jul 22 05:13:54 UTC 2004


>running atop
>
>MEM |  tot 497.1M | free   11.3M | cache 221.8M | buff   19.4M |
>SWP | tot  511.9M | free  511.9M |              | swin       0 | 
>
>i've noticed my swap wasn't even bothered .. but my memory is being much
>consumed even though only few apps are running that is my real concern 
>
>but if these is TOTALLY normal, maybe i am just expecting my free memory
>will be will 256M or less..
>  
>
Unused memory is wasted memory. Someone else pointed it out before, but I'll repeat it with an example:

The linux kernel will "use" available memory in buffers and in it's disk cache. If an application actually wants to use this memory, it can. If no apps are using the memory, however, it may as well be in your disk cache.

Below is the output from the 'free' shell command. The machine has 2 GB of RAM.


 $ free
             total       used       free     shared    buffers    cached
Mem:       2069640    1589412     480228          0     120280    735480
-/+ buffers/cache:     733652    1335988
Swap:      6835492     658660    6176832


The 'total' column in the 'Mem' row shows that it has 2 GB of ram. Further down that column we see it has ~7 GB of swap.
The 'used' column shows that there is about 1.5 GB of ram used, and about 650 MB of swap. 

This machine has got about 480 MB of ram that is unused. However, it also has 120 MB in buffers, and 730 MB or so in the cache.

The second line (-/+ buffers/cache:) subtracts the buffers and cached values from the used total, and adds it to the free total.

So we see that we're actually "only" using 730 MB of ram, and we have 1.3 GB of ram or so free.



Note that the fact that we have 650 MB of ram in swap isn't a bad thing either: It's in swap because a program has requested it but it hasn't been accessed for a long time. When whichever program it is that is using that memory wakes up, it'll be paged out of swap.  If the program isn't actually doing anything, why keep it in physical memory?

The 2.6 kernel allows you to tune the 'swappiness' of your computer - ie, how quickly it'll push stuff out to swap if you're not using it. Some people advocate swapping out as soon as possible, other people think things should be held in memory for as long as possible. It really depends on what you're doing with the machine. (the one above is a multi-user server, we have about 15 thin-clients running remote X off it. Mozilla is our largest consumer of RAM.)

Daniel

-- 
Daniel Lawson
WAND Group, Computer Science Department
University of Waikato
email: daniel at wand.net.nz 	phone: +64 7 838 4466  ext 6254





More information about the fedora-list mailing list