memory usage displsy

Dan Nelson dnelson at allantgroup.com
Wed Sep 2 03:16:35 UTC 2009


In the last episode (Sep 02), Per olof Ljungmark said:
> Dan Nelson wrote:
> > In the last episode (Sep 01), Bill Moran said:
> >> In response to Per olof Ljungmark <peo at intersonic.se>:
> >>> What is a good way to find out how memory is used? Have a 6.4 box
> >>> where memory is used by something but I fail to see what is using it -
> >>> tried different switches to ps(1), tried the stat tools but a big
> >>> chunk of memory does not show at all.
> >>>
> >>> A proper tool for analyzing memory usage "live", this is a production
> >>> box?
> >>
> >> I've always been able to get what I need from top.  You can do -o res to
> >> sort by resident memory usage, which helps.
> > 
> > ps will sort by memory usage when given the -m flag.  Also check ipcs -a
> > to see if there are any sysv shared memory segments hanging arnound.  If
> > you don't see anything using the memory, where are you seeing that
> > "something" is using it?
> 
> What I see is a slapd process using about 150M, then around a hundred imap
> processes 5-10M each.  If the server is restarted, 70-80% will be free,
> now, after three months we're at 11% free loosing about 20% per month.
> 
> The exact sum VSZ right now as shown by ps is 1073632k but top says
> 
> Mem: 3111M Active, 311M Inact, 230M Wired, 144M Cache, 112M Buf, 27M Free
> 
> Clearly something is grabbing memory and not releasing it.

Disk cache, most likely.  I would expect "Free" memory as reported by top to
drop down to under 100MB a few hours after a system is rebooted.  The
difference between Active->Inact->Cache->Buf is more an indication of how
long ago a particular page has been touched (and how much work it is to map
the page back into a processes memory space), and doesn't really say what
the block is being used for.  If you are not actively swapping, there is no
need for panic.  Even a couple hundred MB of used swap is fine, as long as
you're not constantly having to pull it back into memory.

http://www.freebsd.org/doc/en/books/arch-handbook/vm.html has a good rundown
of how the VM system works.

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list