Inactive memory

Chuck Swiger cswiger at mac.com
Tue Feb 8 14:13:23 PST 2005


Pat Maddox wrote:
> Alright, that lets me know that it's not an entirely bad thing.  It
> does say, however, that it's fine as long as the free memory isn't
> REALLY low.  It did get down to 13MB though, as I said.

Really low means less than 1 MB.  That would indicate the VM system is under 
so much pressure that it can't maintain the minimum amount of free space it 
wants to have:

vm.v_free_min: 378
vm.v_free_target: 1655
vm.v_free_reserved: 143
vm.v_pageout_free_min: 34
vm.v_free_severe: 260

These numbers are likely to be in 4K pages, 260 * 4K = 1040K ~= 1 MB, and will 
vary slighty depending on available physical RAM, kernel size, and probably 
the phase of the moon.  :-)

> So now I understand that it's alright for the free memory to be low. 
> I don't understand how the inactive, cache, and buffered memory are
> used though.  When a process uses up all the free memory, does it then
> use some from inactive, or does it use swap?

A process will start reusing inactive memory, which involves flushing data to 
disk and/or using swap, depending, but the VM system may well swap out pages 
from other processes instead (especially ones that have been idle for a long 
time).

[ The VM pager uses LRU or actually NFU page selection algorithms with complex 
names like "second chance replacement via clock hand sweep, with working set 
size and global page-fault frequency modelling". :-)  This is a complicated 
topic, and it starts becoming better to look at the code than to try to 
describe the algorithms in words. ]

-- 
-Chuck



More information about the freebsd-questions mailing list