Glossary/Memory

Compressed memory

Also: compressed memory

Quick answer

Compressed memory is data in RAM that macOS has compressed to make more RAM available. Activity Monitor shows the total as Compressed, part of Memory Used.

When RAM gets tight, macOS compresses memory that has not been used recently instead of moving it straight to disk. Compressing and decompressing is usually much faster than reading from the startup disk.

Some compressed memory is normal. The Memory tab shows the total, and you can add a column to see how much of each process is compressed.

Why Compressed memory is high

A large Compressed figure means macOS has had to make room. This is often why memory pressure turns yellow. It is the step before swapping to disk, so it is a sign that apps are asking for more RAM than is free.

How to see which app is compressed

In the Memory tab, choose View, Columns, and add the compressed memory column. Sort by it to see which processes have the most compressed data. Those are often apps that have been open a long time without being used.

What the Compressed figure actually measures

Activity Monitor describes Compressed as physical memory used to store a compressed version of data that has not been used recently. So the figure is the space the compressed data takes up in RAM, not the size the data would be once decompressed.

The data inside is larger than the Compressed figure. That difference is the memory macOS has gained by compressing it.

Apple explains that as the Mac approaches its maximum memory capacity, inactive apps in memory are compressed, which makes more memory available to the apps you are using. That is why apps left in the background for a long time tend to hold the most compressed memory, and why switching back to one of them can take a moment while its data is decompressed.

How compression, swap and memory pressure fit together

macOS manages a memory shortage in stages. Each stage shows up in a different place in Activity Monitor.

  1. Data that has not been used recently is compressed and kept in RAM. The Compressed figure grows.
  2. When compressing is not enough, macOS moves compressed data out to the startup disk. Swap Used grows.
  3. When an app needs that data again, macOS reads it back from disk and decompresses it. If this happens a lot, the Mac feels slow and memory pressure turns yellow or red.

How to check compressed memory in Terminal

Two read-only commands show the same information Activity Monitor uses. Comparing the stored and occupied figures tells you how well your data is compressing. The bigger the gap between them, the more memory compression is saving.

  1. Run top -l 1 | grep PhysMem. The compressor figure in parentheses is the memory holding compressed data.
  2. Run vm_stat. Pages occupied by compressor is the RAM the compressed data takes up. Pages stored in compressor is how large that data would be uncompressed. Multiply either by the page size on the first line to get bytes.
  3. Run vm_stat 5 to print a new line every 5 seconds, and press Control-C to stop. After the first line, which shows totals since startup, the comprs and dcomprs columns show how many pages were compressed and decompressed in each interval.

Normal vs worrying compressed memory

Normal: Compressed stays at a steady level while memory pressure is green. macOS is simply keeping old data in a smaller form. It is common to see some compressed memory even on a Mac with plenty of RAM, especially after it has been on for a while.

Worrying: Compressed keeps rising through the day, Swap Used rises with it, and memory pressure is often yellow or red. The Mac is short on RAM for what you are running, so quit apps you are not using or run fewer heavy apps at the same time.

Questions people ask

What does Compressed mean in Activity Monitor?

It is the amount of memory macOS has compressed to free up RAM.

Is compressed memory bad?

No. It is how macOS avoids using the disk. A lot of it, together with yellow or red memory pressure, means the Mac is short on RAM for your workload.

How do I reduce compressed memory?

Quit apps you are not using. Their compressed memory is released when they quit.

Does compressed memory slow down my Mac?

Compressing and decompressing takes some processor time, but it is usually much faster than reading from disk. You notice a slowdown when the Mac has to compress and swap constantly, which shows up as yellow or red memory pressure.

Can I turn off memory compression on Mac?

There is no option for it in System Settings, and you should leave it alone. Without compression, macOS would have to use the disk sooner, which is slower.

What is the VM Compressed column?

It is a per-process column you can add with View > Columns in the Memory tab. It shows how much of each process's memory has been compressed.

Related

Looking for something better than Activity Monitor? See the best Activity Monitor alternatives for Mac, or browse every term in the glossary.