Tell me more ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm looking for explanation of memory usage on my machine especially in light of the example in this screenshot below:

Memory Usage

I understand what is Free and Active means
But what are the meanings of Wired and Inactive?

Especially inactive, why does it use so much memory for something that we do not use?

share|improve this question
2  
possible duplicate of What is the meaning of Wired Memory in Macbook? – Stu Wilson Oct 11 '12 at 12:10
2  
See support.apple.com/kb/HT1342. – lhf Oct 11 '12 at 12:24
1  
I didn't find a question where the nub was on explaining inactive memory - so I'll write a short article on it. We can link to related questions as there are several that attempt to break down all memory, but don't go into how Inactive RAM works in practice. – bmike Oct 11 '12 at 15:28
2  
We can free up inactive memory with terminal command purge – GusDeCooL Oct 12 '12 at 21:00

2 Answers

up vote 41 down vote accepted

Inactive memory gets a horrible rap due to a crappy name. It should be called "make your Mac really fast the second, third, and fourth time it does the same task" memory except that's an awful name, too.

Here's how I explain things to someone new to the concept of virtual memory:

  • Wired: The system cannot run without this amount of RAM (never swapped)
  • Active: Programs are really using this memory now or in the last few seconds
  • Inactive: Things that programs have read from the slow disk or elsewhere and said they never need again. We know better, you will go back to Facebook in a few minutes or re-launch Word after quitting it.
  • Free: Wasted RAM - you only need one or two MB free since we can simply use some of the Inactive RAM if you need more RAM to do something.

The problem arises when Free+Inactive is less than roughly 1/3 of the total and then things can really get slow.

Inactive memory is bonus speed / double duty RAM. It serves as free at a moment's notice, but also makes repeated tasks much, much faster if the system guessed correctly and kept something in RAM that you will do again. It's faster than swapped memory since it's already loaded in RAM and accelerates things when the virtual memory system makes good guesses.

When you are wondering if RAM is a problem, rather than looking at each of the 4 categories (5 if you count active swap), you can couple W+A as slowing down a new program/task and F+I as speeding up a new program/task. The more F+I you have, the more new programs you can launch before the RAM needs to rely on swapping to juggle the memory that has been allocated.

You don't really need to know how swap works since I mentioned it above. Basically, when a program is sitting idle and hasn't been used for days (or hours) the system will write that RAM to the hard drive rather than kill the program. This lets the system shuffle and handle all sorts of things relating to memory management and keeps each program from needing to talk amongst themselves to agree who will use less memory when the system runs out.

Here is a real world example of how inactive RAM is used.

  1. Quit all apps and make sure the two Apps we are testing are not set to auto start when you log in
  2. Reboot your Mac
  3. Fire up your Activity Monitor and watch the RAM throughout
  4. Time how long it takes to start Application A (MS Word would be a good choice)
  5. Quit A
  6. Time how long it takes to start Application B (Adobe something would also be good)
  7. Quit B
  8. Time how long the second launch of A takes
  9. Quit A
  10. Time B's second launch.
  11. Time A's start the third time with B running.

You should see dramatic speedups for the second / third launch as the system learns to keep in inactive RAM the things these two apps need to run.


In your case - the total of Wired and Active means that some swapping to disk is likely happening and your Mac isn't as fast as it could be since your inactive RAM isn't large enough to store all the things you might need to reuse. If you have a fast SSD drive, this RAM allocation is OK and instead of starting to slow down once less than 1/2 of your RAM is F+I, you can cut things closer to like 1/4 of the total RAM for F+I before seeing noticeable slowness. These guidelines are general, and you'll want to watch vm_stat 15 or some similar interval to ensure continual and medium volume swapping isn't making your Mac slow.

share|improve this answer
3  
Wow very complete answer for newcomer like me. Thank you very much, very appreciated :) – GusDeCooL Oct 11 '12 at 15:22
3  
Yup - I get to answer for everyone - once and for all, people can edit it to make it better and you get your answer. Pretty cool idea for a web site where people can come and ask interesting questions. :-) – bmike Oct 11 '12 at 15:23
2  
Wow! Beautiful answer! – duci9y Oct 11 '12 at 15:27
2  
I wish they explained it like this in my OS class. – styfle Oct 16 '12 at 18:23
I never knew that. Great answer. +1. – Josiah Oct 16 '12 at 20:12

Basically it's broken. Inactive RAM should be "purged" automatically when Free RAM is low. What's the point of holding RAM for previously opened applications hoping that the user will open it again? The fact that Free RAM is low indicates that existing ACTIVE applications might not have enough RAM and is swapping NOW. Keeping GB of RAM for closed applications is just dumb. According to Apple's own description, Inactive RAM should be purged or borrowed automatically when Free RAM is low. This is clearly not the case.

share|improve this answer
1  
Virtual memory systems make large amounts of free RAM a waste. When a program asks for a memory allocation, the kernel makes up more virtual memory and hands it out like candy. Only when a program fills that memory with actual data does the system need to make room in RAM for that operation. That "making room" pulls from free and then inactive memory - and the delay to release inactive memory is immeasurably small. The purge you describe is exactly what happens - just that you imply the system should do the purge work up front when the system is lazy and only does that work if needed. – bmike Feb 4 at 18:37
@bmike But wouldn't hat mean that when there is no free RAM left and I start a new App, that the inactive RAM portion would decline and active would rise? That is clearly not the case and from my experience the system gets extremely slow whenever there is no more free ram left, despite there being gigabytes of inactive ram. The system seems to prefer swapping disk before it considers reusing inactive ram. – codingFriend1 Jun 7 at 13:20
@codingFriend1 Let's be precise - how many pages free in vm_stat do you consider "no more free RAM"? When the Mac is "slow" what are the page in and page out counts for vm_stat 1? Any time I'm watching this on a problem system, I like to have vm_stat 15 running in a terminal window (or logging to the filesystem) so I can know precisely what the paging activity is when deciding if/when I'll tune things like the pager. This example has 100 MB of free RAM, so it's not likely even under paging pressure. – bmike Jun 7 at 19:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.