Apple says: Mac OS X has very efficient memory management. It will automatically allocate memory and adjust the contents of memory as needed. But at times you will find that your system seems to use lot more RAM that it should. Now this is where we get into understanding how Mac OS X deals with Virtual Memory and Caching.
Typically when you close all windows of application you expect application to exit, well that’s true always in Windows world but may not be true always in Mac OS X world. Ever noticed those tiny dots below the icons on dock, they indicate which applications are still around.
In my case, Activity Monitor (3rd from left) is still around even after I have closed it’s main window. This is more of an optimization/convenience built into system where if you want to use the same application again it starts faster, as it is still present in RAM/VM. All such applications contribute to Inactive Memory, as is evident from image below:
System Memory lists 4 types of Memory State:
- Free – this much amount of RAM is free to be used
- Wired – data in RAM that can’t be paged out to Drive. This is directly proportional to # of applications being used and data varies per application
- Active – data that is being/was recently used by active applications
- Inactive – data that was used earlier, but is not being used now. This can be flushed out and at times this is just cached data that needs to be cleaned out.
Most of the times it seems like Mac OS X sucks at managing RAM properly, ~8.5 GB of my RAM is occupied by inactive data which could have been put to better use. But at times it is applications that do this mess. Here I unzipped a very large file (~9GB) and it’s the good unarchiver app that has left this footprint behind.
One of the handy way to clean this up is to use purge command, you need Xcode installed on your system for that. It might freeze your system for a minute or two, but you will get back all that can be reclaimed:
If you don’t care about Xcode then there are quite a few free and paid tools to do the job, try searching in AppStore.
- Mac Rumours (macrumours.com)
- Using Activity Monitor to read System Memory (apple.com)
- Mac OS X Internals – A Systems Approach by Amit Singh (amazon.com)
- Can I force my Mac to make better use of inactive memory (apple.stackexchange.com)
- Trouble understanding Inactive Memory in Mac OS X (stackoverflow.com)