Previous: Mapping Memory Objects, Up: Virtual Memory Interface

5.6 Memory Statistics

— Data type: vm_statistics_data_t

This structure is returned in vm_stats by the vm_statistics function and provides virtual memory statistics for the system. It has the following members:

long pagesize
The page size in bytes.
long free_count
The number of free pages.
long active_count
The umber of active pages.
long inactive_count
The number of inactive pages.
long wire_count
The number of pages wired down.
long zero_fill_count
The number of zero filled pages.
long reactivations
The number of reactivated pages.
long pageins
The number of pageins.
long pageouts
The number of pageouts.
long faults
The number of faults.
long cow_faults
The number of copy-on-writes.
long lookups
The number of object cache lookups.
long hits
The number of object cache hits.

— Function: kern_return_t vm_statistics (vm_task_t target_task, vm_statistics_data_t *vm_stats)

The function vm_statistics returns the statistics about the kernel's use of virtual memory since the kernel was booted. pagesize can also be found as a global variable vm_page_size which is set at task initialization and remains constant for the life of the task.