Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jul 2000 16:16:36 -0500
From:      Dan Nelson <dnelson@emsphone.com>
To:        Ben Smithurst <ben@FreeBSD.org>
Cc:        Glenn McCalley <freebsd@mail.bnetmd.net>, freebsd-questions@FreeBSD.org
Subject:   Re: what is soaking up memory?
Message-ID:  <20000713161636.A13414@dan.emsphone.com>
In-Reply-To: <20000713210418.K48641@strontium.scientia.demon.co.uk>; from "Ben Smithurst" on Thu Jul 13 21:04:18 GMT 2000
References:  <Pine.BSF.4.21.0007130756380.91958-100000@mail.bnetmd.net> <20000713093805.A20695@dan.emsphone.com> <20000713210418.K48641@strontium.scientia.demon.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help

--sm4nu43k4a2Rpi4c
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline

In the last episode (Jul 13), Ben Smithurst said:
> Dan Nelson wrote:
> > Free memory is wasted memory.  The RAM that your programs don't
> > actively allocate is used by FreeBSD as disk cache.  Inact, Cache,
> > and Buf are all cached data at different aging levels.  You
> > actually want as little Free memory as possible.
> 
> I think I'll add this question, with your answer, to the FAQ.  This
> question is becoming a FAQ, after all...

I'm attaching an email Paul Herman sent to be about this; it goes into
a bit more detail, and actually makes sense.


-- 
	Dan Nelson
	dnelson@emsphone.com

--sm4nu43k4a2Rpi4c
Content-Type: message/rfc822
Content-Disposition: inline

Return-Path: <pherman@frenchfries.net>
Received: from gatekeeper.emsphone.com (root@gatekeeper.emsphone.com [199.67.51.100])
	by dan.emsphone.com (8.9.3/8.9.3) with ESMTP id KAA03938
	for <dan@dan.emsphone.com>; Thu, 13 Jul 2000 10:50:33 -0500 (CDT)
	(envelope-from pherman@frenchfries.net)
Received: from mail2.netcologne.de (mail2.netcologne.de [194.8.194.103])
	by gatekeeper.emsphone.com (8.10.1/8.10.1) with ESMTP id e6DFoWU17040
	for <dnelson@emsphone.com>; Thu, 13 Jul 2000 10:50:32 -0500
Received: from bagabeedaboo.security.at12.de (dial-195-14-254-57.netcologne.de [195.14.254.57])
	by mail2.netcologne.de (8.9.3/8.9.3) with ESMTP id RAA08103
	for <dnelson@emsphone.com>; Thu, 13 Jul 2000 17:50:29 +0200 (MET DST)
Received: from localhost (localhost.security.at12.de [127.0.0.1])
	by bagabeedaboo.security.at12.de (8.10.2/8.10.2) with ESMTP id e6DFnDM02156
	for <dnelson@emsphone.com>; Thu, 13 Jul 2000 17:49:13 +0200 (CEST)
Date: Thu, 13 Jul 2000 17:49:13 +0200 (CEST)
From: Paul Herman <pherman@frenchfries.net>
Sender: pherman@bagabeedaboo.security.at12.de
To: Dan Nelson <dnelson@emsphone.com>
Subject: Re: what is soaking up memory?
In-Reply-To: <20000713100917.C20695@dan.emsphone.com>
Message-ID: <Pine.BSF.4.21.0007131731260.229-100000@bagabeedaboo.security.at12.de>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

Hi Dan,

This whole active thing bit me about a week ago on a different thread,
but that was because there are about 3 different definitions of
"active" memory -- so it's still fresh in my head.  Here, we are both
talking about top, so there won't be any confusion...

On Thu, 13 Jul 2000, Dan Nelson wrote:

> > Perhaps I read it wrong, but he said 125MB Active.
> 
> Active is cached memory also :)  Since under FreeBSD, the VM and disk
> subsystems are the same, all allocated memory is "cached".  If the
> paging/caching algorithm decides that a page is too old, it checks to
> see where the page came from.  If it's backed by a disk file, it just
> frees the page.  If it's malloced memory, it dumps the page to swap.

Pretty close.  Active memory are physical pages in memory that are
currently referenced by a program.  Period.  There can be more than
one reference, in which case you would say the page is "shared", but I
think "cached" would be the wrong term.

When the page is freed by the program (i.e. reference count goes to
zero) it gets bumped down into "Inactive" if the page is dirty, or
into the "Cache" bucket if it's clean.  That's all.  No magic.  But...

Periodicaly, especially if the system is low on memory, it starts
cleaning dirty pages in the "Inactive" queue, and moves them into the
"Cache" bucket (the number of these pages is the "pdpgs" statistic in
systat(1)).

I think that is what Dave Greenman was talking about, but bear in
mind, if you system isn't starved for memory, then it won't move any
pages from Inact -> Cache.  So, I don't think you can pin it down to
just a matter of seconds.

You're right, Buf is just a cache for filesystem nodes, and isn't a
part of this system.  Neither is Wired, for that matter.

What *is* based on a matter of seconds (which is what bit me in
another thread) is the "active" memory shown by vmstat.  This is
memory that has been accesed by a program in the last 20 seconds.

Whew!  :)

-Paul.

P.S. If you think this is useful, you can post it to the list, but I
think it's basically convered in the handbook section "FreeBSD VM
Internals"

--sm4nu43k4a2Rpi4c--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000713161636.A13414>