Making sense of inactive RAM
A few users have noticed that over time the amount of free RAM on their systems seems to go down, even if the active RAM size has not changed much. When looking at the "System Memory" pie chart in Activity Monitor, its apparent that the "Inactive" memory segment seems to be growing. The question is whether or not this will affect performance, and what can be done about it?
A few users have noticed that over time the amount of free RAM on their systems seems to go down, even if the active RAM size has not changed much. When looking at the System Memory pie chart in Activity Monitor, it's apparent that the "Inactive" memory segment seems to be growing. The question is whether or not this will affect performance, and what can be done about it?
There are four ways that RAM is described by the system: free, wired, active, and inactive.
Being rather self-explanatory, this is the amount that has not been recently used by an application or system process.
This is the amount that must be kept active for the system to run. This RAM cannot be written to virtual memory on the hard disk.
This is the current amount of memory besides wired RAM that is being used by system and user processes.
This is the amount that has recently been used but is no longer required. It may have been used by a recently quit process, or by an active one that no longer needs it, and is not required for use. This RAM is essentially free RAM, with the exception that OS X has kept track of what has recently been loaded into it.
What does this mean?
The use of inactive RAM allows the system to more quickly relaunch those recently used processes, and therefore increase the speed of the system. Instead of having to load the RAM contents from the hard disk, the system will just convert the inactive RAM back to being active.
While this is beneficial to the system, it is a little deceptive when trying to determine the amount of free RAM on the system. If you are concerned about your system not having enough RAM, do not just look at the free RAM amount, but instead add up both the free and inactive RAM amounts.
As an example, on my PowerMac G5 with 2GB RAM, upon checking Activity Monitor I have a small sliver of free memory available (~33MB). At first glance this may appear as though I am completely out of memory; however, I have about 700MB of inactive RAM as well, meaning that overall I have 733MB available for use with new or reactivated system processes.
Despite this, some people still like to see green values and a larger free RAM amount. While we advise to allow the system to manage RAM for best performance, there are a couple of utilities you can use to make the green part of the memory pie chart as big as possible.
If you have Apple's Computer Hardware Understanding Developer tools installed (available from the Apple developer Web site--free, with registration), you should have the purge command installed, which can be run to free up some of the inactive memory.
The utility iFreeMem is useful for clearing out unused RAM by demanding as much RAM as possible from the system, forcing the system to write as much memory to disk as possible and otherwise clear the RAM, and reducing the overall memory footprint. We did a, so be sure to check it out to see how it runs.
Keep in mind that the combination of free and inactive RAM is still not the total available RAM in the system, because if you put high memory demands on the system, other program's active RAM will be progressively written to virtual memory so it can be freed for use. The system cannot do this with wired memory, but it can do it with active memory.