Quickly Clear Inactive Memory in OS X

I recently bought 8 GB of RAM for my 2009 MacBook Pro and it was a significant improvement over the 2 GB that was previously installed. Everything ran a lot smoother and I could run way more programs at once than previously. However, there was one thing that kept bothering me.

Every time I went into Activity Monitor, I would notice that a lot of the memory was “Inactive”. After doing some short reading online, I realized there are all kinds of takes and philosophies on what inactive RAM is and whether it’s better for the RAM to be inactive or free, blah blah blah. Way too many opinions about that. I just wanted to clear it because I prefer it to be free memory rather than Inactive. Am I right? Who knows, but I’ll see how my system runs and post a comment on the results.

inactive memory

Anyway, if you want to clear the inactive RAM yourself, there is a way to do this. In order to do this, however, you need to have the developer tools installed on your Mac. I already have them installed because I have tried to write iPhone apps. Basically, you need to have Xcode installed. If you don’t want to install Xcode, then you have to download some third-party program, but I don’t recommend this at all. It’s better not to use the command than to use some third party app.

Actually, the only reason I really wanted to free up the inactive RAM was because I wanted my virtual machine to run faster. I am running VMWare Fusion and noticed that if there was a small amount of free memory available and lots of inactive memory, it would take a  long time for the inactive memory to be switched to free memory. Instead, by clearing out the inactive memory, the virtual machine can quickly use up that free memory and runs smoother.

I would not suggest doing this all the time or too often as the memory management in OS X is very good overall. And if you have 8 GB’s of RAM like me, it’s not really necessary unless you have a specific case like I do. If you are running some huge memory-intensive application, then it will come in handy.

So how does one do it already? Simple! Once you have Xcode installed, just open up Terminal and type in the following command:

purge

It doesn’t require any parameters or anything else, just the word purge. You can see a screenshot below:

purge

It’ll take up to a minute to perform the task of freeing up the memory and in that time, things might run a little slow. Once you see the prompt again, you’ll know it’s finished. Now when you go back to Activity Monitor, you should see Inactive Memory be less than 100 MB. In the screenshot above, it’s 95 MB. Before that, it was a whopping 3 GB.

Again, I’m not saying this is necessarily beneficial to do this, I just know it works for me in certain situations. You’ll have to play around with it to see if it makes any difference for you. Enjoy!

More posts from the OS X Category

Connect-To.png

Connecting to a Remote or Local Server

How to Lock Screen in OS X

migrationasistant

The Mac-way: What Every Switcher Needs to Know

Cleaning up Your Mac with Disk Doctor

Leave a Reply