This is an old revision of the document!
A plain language description of the memory stats seen in places like top(8) and sysctl output, designed specifically for a non-developer audience.
General
Userland memory is generally either Anonymous (swap-backed) or (file-backed)
Memory Classes
Active Queue
- “Actively” (Recently) used by userland
- Moved to Inactive when act(ivity)_count=0 (by pagedaemon)
- act_count is updated by hardware page access bits
- “Second Chance” replacement algorithm
Inactive Queue
- Inactively (not recently used) used by userland
- Not recently used (LRU)
- Cannot be re-allocated to other processes
Cached
- Almost “Free”
- Backed by swap or files (ie mmap())
- Available for re-allocation
Free
- Literally Free.
Wired
- Locked in-memory (by kernel, mlock, etc)
- Cannot be swapped out
- Kernel, kernel modules and kernel heap live here
Other
Buffer
- Accounts for Disk IO cache entries for non ZFS filesystems
- Actual data may be stored in Active, Inactive or Wired
- Only usable by the kernel
Thanks
Special thanks to avg and zont for putting up with my probing questions for over an hour to squeeze this valuable information out :)