Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Jan 2009 12:29:47 -0500
From:      Tim Kellers <timothyk@wallnet.com>
To:        David Scheidt <dscheidt@panix.com>
Cc:        RW <rwmaillists@googlemail.com>, freebsd-questions@freebsd.org
Subject:   Re: RAM/Memory resources on 7 STABLE
Message-ID:  <4972158B.4030806@wallnet.com>
In-Reply-To: <20090117021409.GA3730@panix.com>
References:  <4970C565.1000304@njit.edu>	<20090116222249.S10333@wojtek.tensor.gdynia.pl>	<20090117012519.71feb293@gumby.homeunix.com> <20090117021409.GA3730@panix.com>

next in thread | previous in thread | raw e-mail | index | archive | help
David Scheidt wrote:
> 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.
>
>   

For comparison's sake here is the top -P output from my Dell 2950 dual 
quad core server; this one is has 8 GB or RAM installed



last pid: 94403;  load averages:  0.02,  0.38,  0.63   up 11+21:13:56  
12:12:47
69 processes:  1 running, 68 sleeping
CPU 0:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
CPU 1:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
CPU 2:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
CPU 3:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
CPU 4:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
CPU 5:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
CPU 6:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
CPU 7:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
Mem: 226M Active, 2683M Inact, 465M Wired, 552K Cache, 214M Buf, 4537M Free
Swap: 16G Total, 16G Free


 > uname -a
FreeBSD dl 7.1-STABLE FreeBSD 7.1-STABLE #7: Mon Jan  5 13:53:52 EST 
2009     root@dl:/usr/obj/usr/src/sys/AMD  amd64

And here is the top -P from my Dell 2850 dual core server with 12 GB RAM 
installed:

last pid:  9877;  load averages:  0.07,  0.04,  0.07    up 6+22:31:45  
12:20:13
98 processes:  1 running, 97 sleeping
CPU 0:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
CPU 1:  0.0% user,  0.0% nice,  1.5% system,  0.0% interrupt, 98.5% idle
CPU 2:  0.4% user,  0.0% nice,  0.0% system,  0.0% interrupt, 99.6% idle
CPU 3:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
Mem: 242M Active, 10G Inact, 431M Wired, 128M Cache, 214M Buf, 943M Free
Swap: 2014M Total, 2014M Free

FreeBSD www 7.1-STABLE FreeBSD 7.1-STABLE #2: Tue Jan  6 19:24:57 EST 
2009     root@www:/usr/obj/usr/src/sys/DELL64  amd64


Both of these machines are running nearly identical software; the main 
difference is that the 2950 quad core is also running Samba. I can see 
the numbers move up and down between Free and Inactive on the 2950, but 
the 2850 just continues to have Free in decline; it now shows 10G 
inactive.  When I stop and restart apache, MySQL and Mailman on the 
2850, I can see an small increase in the Free and a decrease in 
inactive.  As far as I know, neither machine has ever gone into swap.  
The 2850 has only 2 G of swap space because originally the machine only 
had 1 G of RAM.  I don't know what the Free vs Inactive numbers were on 
that box back then.  I just never noticed the numbers.

Again, I don't know that there is any problem at all, I'm just trying to 
understand why the 2 machines would have such different amounts of 
Inactive and Free memory.

Tim





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