Cache Memory in top command

RW rwmaillists at
Wed Sep 29 17:37:05 UTC 2010

On Wed, 29 Sep 2010 14:41:16 +0200
Bas Smeelen <b.smeelen at> wrote:

> On 09/29/2010 01:42 PM, Bruce Cran wrote:
> > On Wed, 29 Sep 2010 08:57:09 +0200
> > Bas Smeelen <b.smeelen at> wrote:
> >
> >   
> >>  *Cache:* number of clean pages caching data that are available for
> >> immediate reallocation
> >>
> >> <>
> >>     
> > I believe the "Cache" value is almost totally unrelated to the
> > amount of memory used for caching: FreeBSD has a unified buffer
> > cache so any memory is available for use as cache. Unlike Linux,
> > you can't look at the line in 'top' to see how much memory is being
> > used for buffers and cache.
> >
> > You can find more information about the VM architecture at
> > .
> >
> >   
> The way I understand it:
> The amount of cached file data pages is included in the Wired value
> The amount of free cache pages that can immediatly can be re-used for
> caching is the Cache value

I don't see why it would be included in wired, and I'm pretty sure
that's wrong. 

The cache queue is a stock of clean pages, it's sort of an intermediate
state between inactive and free. Most memory allocations can be
performed directly from the cache queue, which allows memory to hold
useful data right up to the moment it's reallocated, and it allows
FreeBSD to run with very little free (i.e. wasted) memory.

Cache memory is topped-up with memory from the inactive queue in the
background. Likewise inactive memory is topped-up from active memory.
Since that's done on demand the values are virtually meaningless. 

> The Buf value is the numbder of pages used for BIO-level disk caching
> I think that the value of Inactive also includes some kind of
> application data cache

Pretty much anything that isn't permanently wired  can end-up in the
Inactive queue it's a general purpose queue for ageing-out memory.

> So as you also state, unlike linux there is no way of determining the
> amount of memory used for *all caching* with top

FreeBSD sees most memory as a cache of a disk backing-store. So when
you are running a program, it's executing inside a cache of the on-disk
binary and its variables are a cache of the swap backing-store.

More information about the freebsd-questions mailing list