MacOS – Understanding active, inactive, free and swap memory allocation

activity-monitormacbook promacosmemoryperformance

this is a conceptual question that came up from an issue I have.

I've been monitoring memory usage with iStat Pro and Activity Monitor for some weeks, since my MacBook Pro (OSX 10.8.4 Mountain Lion 8Gb RAM) became slower to change between applications and started to take some seconds to show me text when I start typing, or even take more than 5 seconds to let me put password when reopening my (turned on) laptop.

I've been reading some topics about this, and generally when I close Safari and Chrome and reopen them, it gets better, although sometimes I need to purge on Terminal to free up some memory, but actually I don't have a good idea about the way OSX manages its memory.

As far as I understand, Active Memory is for tasks that are currently being executed, Inactive Memory is for closed apps that may be potentially reopened, Free Memory is fully available memory, but what about Wired Memory, Swap Memory, VM size and Page ins / outs I see on Activity Monitor?

Since OSX comes pre-configured to have optimal performance (theoretically), I don't really like to purge and I don't want to change memory swapping configurations before having a good understand about what I am doing.

Can anyone better explain to me how these memories works out and make some suggestion for my issues? Specially the one with the password, If it helps, I noticed it became tougher when I started to use WiFi connection and turned WiFi permanently on.


EDIT: After OS X 10.9 Mavericks, the password issue has disappeared either on WiFi or not. Now I can open the laptop and immediately start typing my password and it accepts.

Best Answer

Wired memory is memory that the Operating System has reserved for itself, and it cannot be written to disk.

VM Memory is the amount of space on your disk that the system has allocated for virtual memory. This is slow, and one of the main reasons why running low of free RAM will bring your system to a crawl.

Page ins / outs are when RAM memory is written to the disk (out) and when it is copied back from the disk into RAM (in).

Swap is how much of the VM Memory the system is actually using.

This, and more, can also be found here: http://www.interrupt19.com/2009/06/15/os-x-memory-usage-explained/ and here: http://support.apple.com/kb/HT1342?viewlocale=en_US&locale=en_US

Make sure you have enough free space on your disk for the OS to swap as needed. A good rule of thumb is that 10% of your total disk capacity should always be free. Furthermore, have you noticed any particular apps giving you trouble? Those tools you're using can be powerful for narrowing down what is causing your problem. Also, if you are running Chrome and Safari simultaneously, I suggest you only run them one at a time, as they both tend to be memory-hungry in my experience.