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.
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
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.
$ sysctl -n machdep.cpu.brand_string && sysctl -n hw.ncpu && sysctl -n hw.memsizeFind 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.
$ 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.
$ sudo purgeHow 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
- SYSCTL Command: Get or set the kernel state in macOSEvidence: Documents sysctl -a listing, -n value-only output, and the hw/machdep kern trees.
- vmmap(1) macOS man pageEvidence: Man page for vmmap: shows the virtual memory regions of a process, with --summary for an aggregated breakdown.
- Finding Memory Abuses - Apple DeveloperEvidence: Apple documentation recommending vmmap alongside leaks to analyse process memory footprint.
- purge(8) – force disk cache purgeEvidence: Manual page: purge attempts to purge disk buffer cache, per iOS/macOS memory pressure behavior
Last verified: 2026-09-21
Related guides
Find out whether macOS detects your external monitor, re-apply a working display mode with displayplacer, and verify the connection is healthy.
Check battery health, hunt down CPU-hungry and sleep-blocking processes, and tune sleep settings to stop fast battery drain on macOS.
Diagnose a stubborn Bluetooth device with system_profiler, then power-cycle Bluetooth and restart bluetoothd to get it connected again.