MacOS – Why is it that the Mac would rather swap than clear inactive memory

macmacosmemoryvirtual-memory

Why is it that my Mac (running 10.8 Mountain Lion) would rather swap than clear inactive memory? I know people say that the Mac OS manages itself and whatever, but there is a serious performance dip when my MacBook starts swapping out, even though it would have over 1.5 GB of inactive memory that isn't being cleared out. I have a launcher for the purge command in my dock – thats how severe it is!

Section of Activity Monitor showing memory statistics

Note the 2.21 GB of inactive and the 127.1 MB of swap, which, through the use of all the programs in my workflow, (Photoshop + Illustrator + Dreamweaver + Publisher etc.) will grow rapidly unless I use the purge command, saving my computer from a slaughter fest of beach balls.

Best Answer

I recently answered a question like yours, so thought I'd restate the major points for you, in case this is still a problem.

Mac OS X allocates and uses RAM differently than most versions of MS Windows and can be confusing at times. Microsoft originally built Windows to keep as much memory free as possible. Apple's memory model follows a guideline that empty RAM is a wasted resource that could be better utilized to enhance performance.

Here is a quick and somewhat simplistic breakdown of how your RAM is currently being used:

  • Wired: memory reserved and used by the operating system
  • Active: memory used by currently running programs
  • Inactive: memory used by programs you previously ran since your last reboot, but have since quit. Most people use a few programs repetitively all the time and may switch between them by quitting one program and then launching another. Rather than releasing the memory to be "free", the inactive programs are cached and ready to run again. Some or all of this memory will be combined with Free memory as needed by the system or programs. OS X at times seems reluctant to release inactive memory.
  • Free: memory as of yet unused since the last boot.
  • Used: total of wired, active and inactive.

The VM statistics are reset every time you reboot.

If your MacBook is capable of being upgraded beyond 4GB RAM, I'd definitely invest in a pair of 4GB SO-DIMMs for a total of 8GB installed. One other point to keep in mind concerning your MacBook is that typical notebook hard drives are slower than many of their desktop counterparts. I replaced my first generation unibody MacBook Pro's hard drive with a 256GB SSD. Performance incomparable with any "modern" MacBook Pro. The increase from hard drive to SSD was quite a bit more noticeable than my upgrade from 4GB to 8GB of RAM.