Use Activity Monitor to Track Mac Memory Usage

Track and Understand Memory Usage and If More RAM Is Needed

Activity Monitor showing memory pressure.
You can use Activity Monitor, a system utility included with OS X, to monitor RAM usage. Screen shot courtesy of Coyote Moon, Inc.

It can sometimes be difficult to get your head around OS X memory usage, the Activity Monitor app can help especially when it comes time to consider upgrades for your Mac. Will adding more memory provide a significant performance increase? That's a question I often hear, so let's discover the answer together.

Activity Monitor

There are a handful of good utilities for monitoring memory usage, and if you already have a favorite, that's fine.

But for this article, I'm going to use Activity Monitor, the free system utility that comes with all Macs. I like Activity Monitor because it can sit unpretentiously ​in the Dock, and display current memory usage as a simple pie chart on its Dock icon (depending on ​OS X version). A quick glance at the Activity Monitor Dock icon, and you know how much RAM you're using and how much is free.

Configure Activity Monitor

  1. Launch Activity Monitor, located at /Applications/Utilities.
  2. In the Activity Monitor window that opens, click the 'System Memory' tab.
  3. From the Activity Monitor menu, select View, Dock Icon, Show Memory Usage.

For Snow Leopard and Later:

  1. Right-click the Activity Monitor Dock icon and select Options, Keep in Dock.
  2. Right-click the Activity Monitor Dock icon and select Options, Open at Login.

For Leopard and earlier:

  1. Right-click the Activity Monitor Dock icon and select Keep in Dock.
  2. Right-click the Activity Monitor Dock icon and select Open at Login.

    You can now close the Activity Monitor window (just close the window; don't exit the program). The Dock icon will continue to show the RAM usage pie chart. In addition, Activity Monitor will run automatically whenever you restart your Mac, so you'll always be able to monitor memory usage.

    Understanding Activity Monitor's Memory Chart (OS X Mavericks and Later)

    When Apple released OS X Mavericks, it marked a significant change in how memory was managed by the operating system.

    Mavericks introduced the use of memory compression, a method that makes the most of available RAM by compressing the data stored in RAM instead of paging memory to virtual memory, a process that can significantly slow down the performance of a Mac. You can find the details of how compressed memory works in the Understanding Compressed Memory in OS X article.

    In addition to the use of compressed memory, Mavericks brought changes to Activity Monitor and how memory usage information is presented. Instead of using the familiar pie chart to show how memory is divided up, Apple introduced the Memory Pressure chart, a way to express how much of your memory is being compressed to provide free space for other activities.

    Memory Pressure Chart

    The memory pressure chart is a timeline indicating the amount of compression being applied to RAM, as well as when paging to disk finally occurs, when compression isn't enough to meet the demand by apps to allocate memory.

    The memory pressure chart displays in three colors:

    • Green: Indicates no compression.
    • Yellow: Shows when compression is occurring.
    • Red: Compression has reached its limits, and paging to virtual memory has started.

    Besides the color indicating what's occurring within the memory management system, the height of the shading indicates the extent of compression or paging that's occurring.

    Ideally, the memory pressure chart should remain in the green, indicating no compression is occurring. This indicates that you have adequate available RAM for the tasks that need to be performed. When the chart begins to show yellow, it indicates that cached files (similar to inactive memory in earlier versions of Activity Monitor), essentially apps that are no longer active, but still have their data stored in RAM, are being compressed to create enough free RAM to assign to the apps requesting an allocation of RAM.

    When memory is compressed, it requires some CPU overhead to perform the compression, but this small performance hit is minor, and probably not noticeable to the user.

    When the memory pressure chart begins to display in red, it means there's no longer enough inactive RAM to compress, and swapping to disk (virtual memory) is taking place. Swapping data out of RAM is a much more process-intensive task, and is usually noticeable as an overall slowdown in your Mac’s performance.

    Do You Have Enough RAM?

    The memory pressure chart actually makes it much easier to tell at a glance if you would benefit from additional RAM. In previous versions of OS X, you had to check the number of page outs that were occurring, and perform a bit of math to come up with the answer.

    With the memory pressure chart, all you need to do is see if the chart is in red, and for how long. If it stays there for a long period, you would benefit from more RAM. If it only peaks into red when opening an app, but otherwise stays in yellow or green, you probably don’t need more RAM; just cut back on how many apps you have open at once.

    If your chart is often in the yellow, then your Mac is doing what it's supposed to do: make the best use of your available RAM without having to page data to your drive. You're seeing the benefit of memory compression, and its ability to use RAM economically and keep you from having to add more RAM.

    If you’re in the green most of the time, well, you don’t have any worries.

    Understanding Activity Monitor's Memory Chart (OS X Mountain Lion and Earlier)

    Earlier versions of OS X used an older style of memory management that doesn’t make use of memory compression. Instead, it tries to free up memory that was previously allocated to apps, and then, if needed, page memory to your drive (virtual memory).

    Activity Monitor Pie Chart

    The Activity Monitor pie chart shows four types of memory usage: Free (green), Wired (red), Active (yellow), and Inactive (blue). In order to understand your memory usage, you need to know what each memory type is and how it affects available memory.

    Free. This one is pretty straightforward. It's the RAM in your Mac that isn't currently in use, and can be freely assigned to any process or application that needs all or some portion of available memory.

    Wired. This is memory your Mac has assigned to its own internal needs, as well as the core needs of applications and processes you're running. Wired memory represents the minimum amount of RAM your Mac needs at any point in time to keep running. You can think of this as memory that's off limits for everyone else.

    Active. This is memory currently in use by applications and processes on your Mac, other than the special system processes assigned to Wired memory. You can see your Active memory footprint grow as you launch applications, or as currently running applications need and grab more memory to perform a task.

    Inactive. This is memory that's no longer required by an application but hasn't yet been released to the Free memory pool.

    Understanding Inactive Memory

    Most of the memory types are pretty straightforward. The one that trips people up is Inactive memory. Individuals often see a large amount of blue in their memory pie chart (Inactive memory) and think they're having memory issues. This leads them to think about adding RAM to boost their Mac's performance. But in reality, Inactive memory performs a valuable service that makes your Mac snappier.

    When you quit an application, OS X doesn't free up all of the memory the application used. Instead, it saves the application's startup state in the Inactive memory section. Should you launch the same application again, OS X knows it doesn't need to load the application from your hard drive, because it's already stored in Inactive memory. As a result, OS X simply redefines the section of Inactive memory that contains the application as Active memory, which makes re-launching an application a very quick process.

    Inactive memory doesn't remain inactive forever. As noted above, OS X could start using that memory when you re-launch an application. It will also use Inactive memory if there's not enough Free memory for an application's needs.

    The sequence of events goes something like this:

    When you launch an application, OS X checks to see if it's stored in Inactive memory. If it is, that memory is reassigned as Active and the application launches.

    If the application isn't in Inactive memory, OS X will carve out an appropriate chunk of Free memory for the application.

    If there isn't enough Free memory, OS X will release some Inactive memory to fill the application's needs. Releasing Inactive memory will remove one or more of the cached applications from the Inactive memory pool, forcing a longer launch time for those applications.

    So, How Much RAM Do You Need?

    The answer to that question is usually a reflection of the amount of RAM your version of OS X needs, the type of applications you use, and how many applications you run concurrently. But there are other considerations. In an ideal world, it would be nice if you didn't have to raid Inactive RAM too often. This would provide the best performance when launching applications repeatedly, while maintaining enough Free memory to meet the needs of any currently running applications. For instance, each time you open an image or create a new document, the related application will need additional Free memory.

    To help you decide if you need more RAM, use Activity Monitor to watch your RAM usage. If Free memory falls to the point where Inactive memory is being released, you may want to consider adding more RAM to maintain maximum performance.

    You can also look at the 'Page outs' value, at the bottom of Activity Monitor's main window. (Click Activity Monitor's Dock icon to open the Activity Monitor main window.) This number indicates how many times your Mac has run out of available memory and used your hard drive as virtual RAM. This number should be as low as possible. I like the number to be less than 1000 during a full day's use of my Mac. Others suggest a higher value as the threshold for adding RAM, in the neighborhood of 2500 to 3000.

    Also remember, I'm talking about maximizing performance of your Mac as related to RAM. You don't need to add more RAM if your Mac is performing to your expectations and needs.