Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jan 2009 21:14:10 -0500
From:      David Scheidt <dscheidt@panix.com>
To:        RW <rwmaillists@googlemail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: RAM/Memory resources on 7 STABLE
Message-ID:  <20090117021409.GA3730@panix.com>
In-Reply-To: <20090117012519.71feb293@gumby.homeunix.com>
References:  <4970C565.1000304@njit.edu> <20090116222249.S10333@wojtek.tensor.gdynia.pl> <20090117012519.71feb293@gumby.homeunix.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Sat, Jan 17, 2009 at 01:25:19AM +0000, RW wrote:
> 
> On Fri, 16 Jan 2009 22:23:06 +0100 (CET)
> Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl> wrote:
> 
> > > When I boot this machine it usually shows (in top) about 11 G Free
> > > in the Mem: line
> > >
> > > The machine, in this snippet, has been up for 5 days 22 hours and
> > > change and it now shows 1436M free in the Mem: line
> > > I've been watching the number and it has been slowly decreasing
> > > over the 5 days since its last boot.  It looks like as the Free
> > > line trends down, the Inact value trends up to keep the total Mem
> > > used at the installed 12G
> > 
> > ALL unused memory is used as disk cache in FreeBSD.
> 
> Although, looking at the output of top, most of the memory is in the
> inactive state. As I understand it cache pages go from active to
> cached, and the inactive queue contains pages that need to be written
> out to swap before they can be reused.

No.  It just means they're not active -- nothing has touched them
"recently".  They may be dirty.  They may not be.  Recently means the
last 20 seconds to a minute, depending.  


> 
> The very high level of inactive memory looks suspiciously like a
> memory-leak to me. Hopefully someone who knows more about this will
> step in - don't take my word for it.

I have no data on the system in question, but it's very common for a
machine to have large amounts of inactive memory, particularly one
that's not under any sort of memory pressure. 

My basically idle workstation has 1.5 GB of memory, 5 MB free, and over
a gig inactive.  Since I'm not doing anything with it (I'm writing this
from another machine), and its just hanging out, this is what I'd expect.
Should it do something that requires memory, the pager will toss clean
inactive pages to the free list, and they'll be reused.  Of course, if
what they're required for is something they already have in them (like
the code segments of "recently" terminated application that's
restarted), they'll get reused, saving having to read them from disk.
The only time you'll large amounts of memory on the Free list is when
a machine is first booted and hasn't touched that memory for anything,
or when an application that's got a large dyanmically allocated block
of memory terminates.  The rest of the time, the free list should be
small.  

If the machine isn't swapping, there's usually nothing to worry about.



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20090117021409.GA3730>