I used to run out of memory with 8GB, then 16GB, and eventually 24GB as my web development setup grew to include more Docker containers, simulations, VS Code, browsers, and terminals. I bought a Mac Studio with 96GB of unified memory so I could keep my development tools open while also running unrelated apps, but macOS now seems to consume nearly all available memory anyway. Chrome is using around 8GB, VS Code about 5GB, Ghostty around 6GB, and Docker roughly 16GB. Activity Monitor also shows significant cached memory and swap usage. Once memory pressure turns red, the entire system becomes extremely slow and I often have to force-quit applications. Is macOS supposed to use swap while cached memory is still available, and can I disable or limit this behavior?
4 Answers
macOS will deliberately use otherwise idle memory for file and application caches, so high memory usage by itself is not a problem. Cached memory can be reclaimed when an app actually needs it. The useful metric is the Memory Pressure graph, along with whether the system is slow or applications are being terminated—not the amount of RAM labeled as used. That said, red memory pressure and severe swapping are real performance problems, so this sounds like more than harmless caching.
Start by identifying which processes are genuinely consuming memory. Ghostty using around 6GB is unusual for a terminal, and Docker's allocation may be configured much higher than necessary. Check individual containers, browser tabs and extensions, VS Code extensions, and any runaway processes. Quit or restart the offending process and see whether usage drops. Also make sure the internal drive has plenty of free space, since macOS needs room for swap.
Swap is not automatically bad, especially if it contains inactive memory that has not been touched for a while. However, continuous swap activity combined with red memory pressure and noticeable lag means the workload is exceeding available memory or an application may be leaking memory. There is no normal switch to turn off macOS memory management or force it to preserve unused RAM; the practical fix is reducing allocations, lowering Docker's memory limit, closing problematic workloads, or finding the process that is growing unexpectedly.
Remember that Apple silicon uses unified memory, so the GPU and system share the same pool. Certain displays, simulators, containers, virtual machines, or graphics-heavy tools can reserve a substantial amount even when the CPU applications do not appear to account for it directly. I would reproduce the slowdown, inspect Activity Monitor's Memory tab and `memory_pressure`, and check whether one application keeps growing. If normal workloads really make a 96GB machine unusable, investigate a bug or memory leak rather than trying to disable caching.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures