[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: RAM economy tips

At 987795117s since epoch (04/20/01 10:31:57 -0400 UTC), giovanni sartoni wrote:
> Hi everybody
> after a few months I am using Debian at home I keep
> wandering whether it uses too much RAM.
> I have 128MB RAM, I run Debian 2.2r3,
> I see 70 - 80 MB used (whow seems worse than Win98 ?!?)
> and the usage keeps rising till 90% as I open/close other applications,
> and stay there.

I'm not sure what you're using to check RAM usage, but there is one common
point of confusion.

Here's the output of the 'free' command on my computer (128 MB RAM):

(run 'free -m' to see the same stats on your box)

total               used       free     shared    buffers     cached
Mem:     123        115        8        0         5           58
-/+ buffers/cache:  51         72
Swap:               243        19       223

That first line seems to indicate that I have 8MB free, and I'm using 115.
This would seem to be a blatant lie, since I only use gdm and X, so what's
going on?

Linux doesn't want your memory going to waste, so it uses most of your
available memory for buffering and caching of data.  Thus, the memory is
'used' in the sense that it is ready to do something useful.  However, if
another program needed that memory, then the kernel would flush some
buffers/cache and yield it immediately.  Basically, the kernel is 'betting'
that you won't want to use all of your memory right now, and so is using it
for caching data that might be useful to you.  This makes the computer more

So, that second line says how much memory is used, after taking into account
buffers and cache.  According to that line, I am using 51MB and I have 72 MB
free.  I'm running X, mySQL, apache, and some other stuff, so that sounds
like a reasonable number to me (and much more reasonable than 115MB!)

Again, I'm not sure what your RAM tool is, but if it reports memory usage
based on the kernel's idea of what is being used, then you'll get that
'incorrect' amount shown on the top line.  No need to panic, though.

You might also run 'top', which is a console-based interactive process
display.  It will show you memory and load stats for all the processes on
your box.

Have fun!


Jason Healy    |     jhealy@logn.net
LogN Systems   |   http://www.logn.net/

Reply to: