memory categories

Benjamin Lutz benlutz at
Sun Dec 14 08:05:06 PST 2003

I'm trying to understand what FreeBSD uses its memory for.
Unfortunately, I've not been able to find documentation that answers all
my questions, so I'm hoping someone on this list can answer them.

Let's start with top(1)'s memory categories:

Free: Not used for any purpose. (vm.stats.vm.v_free_count)

Active: Used by userland programs. (vm.stats.vm.v_active_count)

Cache: Well, this obviously caches something... but what? Filesystem?

Inactive: This seems to be the biggest chunk of memory on my system.
What exactly is the meaning of this? Someone explained it as "memory
that a program has grabbed that isn't currently being used. It can be
swapped to disk if RAM is needed by other programs.". How does the
system know that this memory is not being used? Is this the difference
between the RES and SIZE colums in top(1)'s output?

Wired: I've only been able to figure out that this is memory that's
being actively used and that cannot be relocated in any way. Could
someone explain this in a bit more detail? What exactly is the
difference between active and wired memory? (vm.stats.vm.v_wired_count)

Buf: I'm puzzled... If I add up Free, Active, Cache, Inactive, Wired and
Buf, I get more memory than I have physically installed. I could not
find a sysctl that represents this value. Also, .v_free_count,
v_active_count, v_cache_count, v_inactive_count and v_wired_count add up
to vm.stats.vm.v_page_count... where does this Buf come from?

And some more questions: On my system, these sysctls have these values:
hw.physmem = 1064734720 = 1015.410MB
hw.usermem: 947351552 = 903.465MB
hw.availpages = 259945
vm.stats.vm.v_page_count: 255299
vm.stats.vm.v_page_size: 4096
hw.availpages * .v_page_size = 1064734720 = 1015.410MB
.v_page_count * .v_page_size = 1045704704 = 997.262MB

I have 1024MB of RAM installed. Why is hw.physmem inaccurate? And why
is .v_page_count * .v_page_size less than hw.physmem? Is the difference
between hw.physmem and hw.usermem used for the kernel? If yes, 112MB
seems to be a huge amount?

Phew... quite a few questions... Let's see what answers you can give me!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-questions mailing list