Quickly check Mac OS X’s virtual memory usage

May 16, 2007 - 4 Comments

Virtual memory serves a crucial task in modern operating systems, essentially how it works is that when you run out of real memory (RAM), the slower hard disk will take over as a temporary memory source. The downside is that the hard disk is slower, so running things in virtual memory is not ideal, one of the many reasons why more physical RAM is better. If you’re curious to see how your Mac is handling virtual memory though, you can see a quick overview with the vm_stat command.

Checking Mac OS X virtual memory usage with vm_stat

vm_stat will spit out a generic overview of virtual memory usage, looking something like this:
$ vm_stat
Mach Virtual Memory Statistics: (page size of 4096 bytes)
Pages free: 5231.
Pages active: 130041.
Pages inactive: 73169.
Pages wired down: 53703.
"Translation faults": 84039105.
Pages copy-on-write: 7089068.
Pages zero filled: 32672437.
Pages reactivated: 432070.
Pageins: 62166.
Pageouts: 63545.
Object cache: 1445817 hits of 1470191 lookups (98% hit rate)

If you want a continual update of your virtual memory usage, try adding a numeric value after the vm_stat command, indicating the amount of seconds that pass before refreshing the data. For example:
vm_stat 3
Now every three seconds you will get an update of virtual memory usage.

The man page for vm_stat is rather short, repeated here:

vm_stat displays Mach virtual memory statistics. If the optional
interval is specified, then vm_stat will display the statistics every
interval seconds. In this case, each line of output displays the change
in each statistic (an interval count of 1 displays the values per sec-second).
ond). However, the first line of output following each banner displays
the system-wide totals for each statistic. The following values are dis-displayed:
played:

Pages free
the total number of free pages in the system.

Pages active
the total number of pages currently in use and pageable.

Pages inactive
the total number of pages on the inactive list.

Pages wired down
the total number of pages wired down. That is, pages that cannot
be paged out.

Translation faults
the number of times the “vm_fault” routine has been called.

Pages copy-on-write
the number of faults that caused a page to be copied (generally
caused by copy-on-write faults).

Pages zero filled
the total number of pages that have been zero-filled on demand.

Pages reactivated
the total number of pages that have been moved from the inactive
list to the active list (reactivated).

Pageins
the number of requests for pages from a pager (such as the inode
pager).

Pageouts
the number of pages that have been paged out.

You can also see some virtual memory usage information by using the top command, simply type ‘top’ in the Terminal to see an automatically updated live list of memory usage.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: Bill Ellis in Command Line, Mac OS X, Tips & Tricks, Utilities

4 Comments

» Comments RSS Feed

  1. mugab says:

    Mac OS X is probably the worst at handling virtual memory, I am constantly paging

  2. Mugab:

    Mac OS X uses Page even when its not out of real memory.

    Its not the worst. You are the worst

  3. [...] you’re curious, you can check Mac OS X’s virtual memory usage using the ‘vm_stat’ command, or by using the Activity Monitor (often erroneously called [...]

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates