Why is my Mac using so much memory and swap?

Find out how much RAM you really have, identify the process eating your memory with vmmap, and flush the cache to ease swap pressure.

macOShardwaresysctlmemorycpuvmmapDiagnosticsMedium risk
Check your total RAM with sysctl, then use vmmap --summary <pid> on the biggest consumer to see what is holding the memory.

What this covers

When macOS runs low on physical RAM it pushes pages to swap, which slows everything down and thrashes the SSD. This guide walks you from confirming your hardware limits, to pinpointing the offending process, to relieving the pressure.

Symptom

?Activity Monitor shows memory pressure in the red or yellow, swap usage climbing into the gigabytes, the beachball appearing frequently, and the Mac feeling sluggish even with few apps open.

Confirm how much RAM your Mac actually has

Before chasing a memory leak, check what you're working with. Reading the hardware sysctls shows your total RAM size and CPU details, which tells you whether the machine is genuinely under-provisioned for your workload or whether something is eating memory. If hw.memsize shows a small amount of RAM for what you run, heavy swap use is expected; otherwise a runaway process is the likely culprit.

Get CPU model, core count, RAM size, and boot-time kernel stats from the kernel's sysctl tree.

Command
$ sysctl -n machdep.cpu.brand_string && sysctl -n hw.ncpu && sysctl -n hw.memsize

Find which process is hogging memory with vmmap

Once you've identified the process with the largest footprint in Activity Monitor, take its PID and inspect it with vmmap's summary view. It breaks the memory down by region type (malloc, mapped files, etc.), so you can see whether the usage is heap growth, leaked allocations, or a memory-mapped file. A process whose heap keeps growing over time is your leak; note the process name before moving on.

Break down a macOS process's RAM usage by region and type using the built-in vmmap tool.

Command
$ vmmap --summary <pid>

Flush the inactive memory cache with purge

After large file operations macOS can hold onto gigabytes of cached file buffers that show up as memory pressure. Running purge forces the system to discard those cached buffers immediately, freeing memory and reducing swap pressure. This is a temporary relief, not a fix for a leaking app — quit or restart the process you identified earlier for a lasting result. Success looks like memory pressure dropping in Activity Monitor and swap usage no longer climbing.

Force macOS to discard cached file buffers after big file operations.

Command
$ sudo purge
!purge discards cached file buffers, so disk-heavy tasks may briefly run slower afterwards as caches rebuild. It is a temporary measure — a genuinely leaking app must be restarted or updated, not purged.

How to confirm it worked

Memory pressure returns to green in Activity Monitor, swap usage stops growing, and the Mac stops beachballing during normal work.

Sources

Last verified: 2026-09-21

Related guides