inconsistency of used memory report

Deron Meranda deron.meranda at gmail.com
Fri Feb 18 17:56:13 UTC 2005


On Fri, 18 Feb 2005 16:31:56 +0000, Paul Howarth <paul at city-fan.org> wrote:
> Bob Hou wrote:
> > Hi,
> > I just found the inconsistency of used memory report from top/free and
> > System monitor. The top/free reports ~254MB memory used while System
> > Monitor shows
> > only 120MB.
> > I am using FC3

Understanding free memory versus used memory is commonly
misunderstood.  It's not just a Linux thing, I've seen many advanced
Unix people also confuse it.

You actually want all of your memory to be in use (except perhaps on
an idle single-user desktop system where there's just not enough
workload).  If you've got unused memory just sitting around then
you're wasting the fastest resource your system has.  This is
especially true on I/O-bound systems, such as webservers, fileservers,
etc.  In many cases you can improve performance on these servers just
by adding more memory, even if your applications weren't using all of
what they had before.

What happens behind the scenes is that the kernel will *borrow* any
physicial memory that your applications aren't using and temporarily
use that to buffer disk I/O and so forth.  The less memory your
applications use, the more the kernel can borrow to use for caching. 
However, as soon as an application needs more memory, the kernel will
automatically give up some of the cache it was using.  Your disk I/O
may in response be a little slower, but your application gets the
memory it wants without knowing any different, and when your
application doesn't want it the kernel makes sure it gets used for
something useful rather than just sitting around storing useless bits.

-- 
Deron Meranda




More information about the fedora-list mailing list