"free" for OS X

I combined the front end of 'free' from Linux's procps with the back end of Mac OS X's vm_stat. the result is a cool memory status reporter for OS X. see the man page for 'free' for details.

No reporting for swap usage or shared memory pages. That would require iterating over all threads on the system.

A binary is included in the tarball. If you need to build your own, there is also a Makefile included.

free.tar.gz

I have a browsable and downloadble Git repository

Here's a sample of the output.

that sample indicates that my ibook had 289520 kilobytes of memory used by all running programs. 'top' would have indicated there was 525576 kilobytes used; while true, top isn't very informative, since that is actually the total of all the memory used for caching as well as memory used by running programs.

a lengthy description of virtual memory concepts in OS X

Summary of the terms "wired", "active", "inactive", "used", "free", excerpted from the link above:

Wired

= memory allocated that shouldn't/can't be swapped/paged out (ie its locked into memory -- possibly portions of the OS code for example).

Active

= allocated memory that has been accessed during last N seconds.

Inactive

= allocated memory that hasn't been accessed during last N Secs (quite likely to be first candidates for being swapped/paged out if memory being demanded). [I always think of Inactive memory as the memory used by caches]

Used

= Wired + Active + Inactive

Free

= memory that isn't allocated to any process or the kernel.


Back to Kevin's Page