Memory Accounting

Updated: April 19, 2023

Accounting for the memory used by your system and process can be useful, especially when debugging. This chapter covers examples of how to read memory-related files and calculate reserved memory. Due the varying nature of the different types of mappings, it is a complex process and is dependent on your needs. The calculations, from the process counters provided in the following pages, produce a general value representing reserved memory. To get an accurate value, you will need more complicated calculation from the raw information found in the memory manager.

Terminology

Note the following terminology used in this documentation:

Anonymous state
A page in an anonymous sate is a page that is not backed by an explicit object.
Domain
A collection of contiguous sections of physical memory.
Inactive state
A page in an inactive state is a clean unmapped page, it may be held in cache.
Map
Is a structure that is used to construct the page table entry for each page in the address space.
Region
A region is a sub-range of a process's address space. It is the result of a mmap() call. The pages in a region all share the same backing object, protection bits, and flags.
Wired state
A page in a wired state is a virtual page that is permanently associated with physical memory.
Zero page
A zero page is a new page that is not backed by a file.