A plain language description of the memory stats seen in places like top(1) and sysctl output, designed specifically for a non-developer audience.


FreeBSD's VM operates on memory in units of pages, which have a size of 4KB on most platforms.

FreeBSD uses a set of 3 queues to manage pageable memory. The size of each queue (Active, Inactive, and Laundry) is visible in top(1).

Pageable memory consists of anonymous memory and file data. Anonymous memory has no dedicated backing storage, and will be written to the swap device if the memory needs to be reused for some other purpose. If the swapped-out memory is referenced again, some free memory will be allocated, and the saved contents of the swapped-out memory will be read back in. Examples of anonymous memory include but are not limited to:

File data is simply the cached contents of files, and file metadata. In general, filesystems will maintain their own fixed-size cache of file data and metadata. With UFS, msdosfs, NFS and others, this is called the "buffer cache"; with ZFS this is the ARC (adaptive replacement cache). When memory is evicted from the buffer cache to make room for new data, it is placed in the inactive queue. Memory evicted from the ARC is simply freed immediately and never enters the page queues.

Pages belonging to page queues are in one of two states: clean or dirty. Dirty pages must have their contents saved before they can be reused for some other purpose, at which point they become clean. Dirty anonymous pages are cleaned by writing their contents to the swap device, and dirty file pages are cleaned by writing their contents to the filesystem's backing storage. Once a page is clean, it can be easily freed and reused.

Memory Classes






Memory (last edited 2018-09-06T01:59:29+0000 by MarkJohnston)