Memory Management – Decoding “Inactive” Memory in macOS and MacBook Pro

macbook promacosmemoryvirtual-memory

After a day's of work at my MacBook Pro running Mac OS X 10.6.5, Activity Monitor shows that the majority of my computer's 8 GB of memory is "Inactive", and only a tiny sliver of the pie chart is "Free". This is even when I have closed all applications, with only the Finder running.

What does that mean? Is the "Inactive" memory taken up by something? Or is it actually still available for applications to use? Thanks.

Best Answer

OS X, like most modern operating systems, uses a virtual memory system for managing memory. Among other purposes, this allows the operating system to treat the computer as having an unlimited pool of memory. To achieve this, the OS will page unused parts of RAM out to a disk store known as the swapfile.

Of course, RAM is not unlimited, so OS X groups RAM into four categories: wired, active, inactive, and free. Wired memory is required by the operating system, and can never be paged out of memory. Active memory is memory used by currently-running programs. Inactive memory was used recently by programs which have now been terminated (or haven't been unused in a long time). Free memory is, as the name suggests, RAM that is not being used.

When you launch a program, it gets loaded into active memory. When you quit a program, however, it doesn't get removed from RAM; rather, it gets bumped into inactive memory. This is why it is often faster to re-launch a program -- it is still in RAM (try this with a big program like Firefox).

Once all your memory is used (free memory is 0), the OS will write out inactive memory to the swapfile to make more room in active memory.

If a program gets paged out to the swapfile, and you re-launch it, it'll get pulled from the swapfile into active memory.

So in short, you actually shouldn't care if your free memory is low. In fact, you want it to be low -- free memory is wasted memory (as the OS isn't using it for anything).

When examining how much memory your computer is using, you actually want to pay attention mostly to Swap used, which tells you the size of the virtual memory swapfile, and Page ins, which tells you how often the OS has to pull memory from the swapfile into active memory.