cd /news/ai-agents/free-memory-said-78-and-macos-still-… · home › topics › ai-agents › article
[ARTICLE · art-170075] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=· neutral

Free memory said 78%, and macOS still ran out of application memory

A developer fixed a memory-pressure guard in the open-source mac-yolo-safeguards project after a 48 GB Mac reported "out of application memory" while free memory still read 77–79 percent and swap sat at 14.4 of 15 GB. The revised check now flags swap as pressure only when at least 8 GB is in use and the swap area is mostly full, warning at 80 percent and going critical at 90 percent, and it also corrects a rounding bug that turned 89.5 percent into a critical 90. When memory is critical and no leftover agent processes remain, the guard shows a notice naming the reason and the three biggest memory owners, at most every 30 minutes.

by read2 min views1 publishedNov 15, 2026
Free memory said 78%, and macOS still ran out of application memory
Image: Dev.to

On November 14 a 48 GB Mac showed "your system has run out of application memory" while a pile of coding agents was running. The odd part is that free memory had read 77 to 79 percent all morning. Swap was at 14.4 of 15 GB.

Our guard had a rule that said swap size alone is never pressure, and for good reason. macOS adds swap files as it needs them and leaves cold pages in them, so a big swap number on a healthy Mac is common. We took that too far. That was the bug. "Large swap is not pressure" is true. "Nearly full swap is not pressure" is not.

#

The fix

The pressure check now treats swap as a signal only when both things hold: at least 8 GB is in use, and the swap area is mostly full. At 80 percent it warns, and at 90 percent it is critical.

const SWAP_FULL_MIN_MB = 8192;
const SWAP_FULL_WARN_PCT = 80;
const SWAP_FULL_CRITICAL_PCT = 90;

const swapFull = memory.swapUsedPct != null && memory.swapUsedMB >= SWAP_FULL_MIN_MB;
if (swapFull && memory.swapUsedPct >= SWAP_FULL_CRITICAL_PCT) raise('critical', `swap is ${Math.round(memory.swapUsedPct)}% full`);
else if (swapFull && memory.swapUsedPct >= SWAP_FULL_WARN_PCT) raise('warn', `swap is ${Math.round(memory.swapUsedPct)}% full`);

The 8 GB floor matters. A 1.9 GB swap that is 95 percent full is just a small swap file, and we have a test that keeps it at normal.

The second thing we found was a rounding bug. The percentage was rounded to a whole number when we read it, so 89.5 percent became 90 and tipped over into critical. We now keep the raw number for the comparison and round only when printing the reason. There is a test for 89.5 percent staying a warning and 79.6 percent staying normal.

#

What the guard does about it

Before this, the cleanup could only stop leftover agent processes. Now, if memory is critical and nothing is left to stop, it shows one notice that names the reason and the three biggest owners, for example "swap is 94% full (14378 MB)... most is held by Codex 15.5 GB (318 processes), Claude 8.5 GB (131 processes), Google Chrome 4.2 GB (40 processes)". It shows that at most every 30 minutes, and if macOS refuses to show the notification, the 30 minute timer is not started.

#

Check your own Mac

sysctl vm.swapusage
memory_pressure | tail -1

If the swap line shows several gigabytes used and close to the total (ours was 14.4 of 15 GB), and memory_pressure reports less than about 20 percent free, you are near the wall no matter what the free memory figure says. A small swap area that is nearly full, like 1.9 GB at 95 percent, is normal on its own.

The guard is open source: https://github.com/IgorGanapolsky/mac-yolo-safeguards

── more in #ai-agents 4 stories · sorted by recency
── more on @mac-yolo-safeguards 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/free-memory-said-78-…] indexed:0 read:2min 2026-11-15 · —