A 46GB Compressed-Memory Leak RSS Monitoring Can't See — and the 10-Minute Guard That Reclaims It A developer discovered that macOS's `dasd` daemon accumulated 46GB of compressed memory, invisible to standard RSS-based monitoring, causing a 37GB swap and a 24-hour outage of an autonomous Claude Code environment. The developer implemented a 10-minute guard script that automatically reclaims the leak, restoring system performance and preventing revenue loss. Every automated posting lane on my machine sat at zero for an entire day, and top -o mem swore nothing was wrong. Swap was at 37GB. The actual culprit — dasd , holding 46GB of compressed memory behind a 264MB RSS — never appeared anywhere in the top 20. Once a guard script started running every 10 minutes, the same leak got reclaimed at 02:32 in the morning with swap back down to 4.1GB, and I found out from a log line instead of from a day of missing revenue. I started at 100k yen/month as a university student, pushed it to 600k/month juggling multiple gigs, got laid off for reasons that had nothing to do with me and went back to zero, then spent six months rebuilding an autonomous Claude Code environment. It now runs at 1.2M yen/month in revenue. This is the story of the day that environment stopped for a full 24 hours. For years, memory monitoring on macOS was fine with just top -o mem . Sort by RSS descending, eyeball the list from the top, investigate anything over 500MB. That's how a lot of people operate, and I thought so too. On August 9, 2026, that premise collapsed completely. Every lane of my SNS auto-posting had produced zero posts for a full day. The Playwright instance managed by Claude Code looked like it was running. Going back through the logs, launchPersistentContext had been timing out at 180 seconds over and over. Hunting for the cause, the first thing I ran was top -o mem . Nothing suspicious in the top 20 processes. The largest RSS was a few GB, and dasd didn't appear anywhere in the list. I noticed it when I checked swap usage on top 's other screen. 37GB. Nearly double the physical RAM. With swap that inflated, any new memory request is essentially disk I/O. The moment Playwright tried to create a browser context, the OS started reading and writing swap to secure pages, and that blew past 180 seconds and failed. So where was the culprit that pushed swap to 37GB? The vm.swapusage numbers were obviously abnormal, yet nothing showed up in RSS-sorted top . macOS top has a cmprs compressed memory column available via the -stats option. It's the mechanism where the OS zlib-compresses memory that isn't being actively used and packs it into RAM, keeping only the mapping to the actual pages — and this compressed region is not counted in RSS. It uses physical RAM but does not show up in RSS monitoring. Running top -l 1 -n 20 -o mem -stats pid,command,mem,cmprs , dasd was there in the output. PID COMMAND MEM CMPRS ... 1842 dasd 264M 46G The RSS-equivalent MEM is 264MB. That's exactly why it could never crack the top 20 of an RSS-descending list. But CMPRS is 46GB . That is the cause of the 37GB of swap. dasd Duet Activity Scheduler, macOS's background task arbitration daemon had accumulated 46GB of compressed memory in 21 hours of uptime, and the OS had no option left but to escape into swap. The reality behind 1.2M yen/month is automation scripts and Claude Code running continuously in parallel. Posts go out to social while I'm asleep, the funnel keeps turning, and by the next morning the results are compiled. When that machinery stops for a day, the damage lands directly on revenue. Restarting dasd by hand takes five minutes. The problem is that it will stop again . I actually left a comment noting that this symptom "occurs after 21 hours of uptime." If the same thing happens the next day and the day after, that creates a daily chore of checking top every morning and typing sudo killall dasd . That's a "task," not an "environment." The iron rule of an autonomous environment is "it's already fixed even if I never noticed." A monitoring script runs every 10 minutes, restarts things when they cross a threshold, and a notification lands in Discord. When I look at the log the next morning and it says "reclaimed at 02:32 AM," that's the environment behaving correctly. On top of that, dasd wasn't the only problem. iii agentmemory, the Node.js process that manages the agent's session memory existed as a second leaker , growing at roughly 4GB per hour. With two leaks happening at once, a setup that assumes manual response hits its limit. Threshold design matters too. dasd 's RSS is 264MB — an RSS-based threshold would never trigger. So I use the value in the mem column, which sums CMPRS and MEM ≒RSS . The script's to mb function handles that. to mb { awk -v v="$1" 'BEGIN { u = substr v, length v , 1 ; n = substr v, 1, length v - 1 + 0 if u == "T" { printf "%.0f", n 1024 1024 } else if u == "G" { printf "%.0f", n 1024 } else if u == "M" { printf "%.0f", n } else if u == "K" { printf "%.0f", n / 1024 } else { printf "%.0f", v / 1048576 } }' } It converts what top returns — "47G" or "264M" — into numeric MB and compares against the threshold. Because dasd shows "47G" in the MEM column a virtual total that includes CMPRS , a 5120MB 5GB threshold detects it correctly. At 264MB of RSS, it would slip past forever. ┌────────────────────────────────────────────────────────────┐ │ launchd com.lily.mem-hog-guard │ │ 毎時 :02 :12 :22 :32 :42 :52 に起動(10分間隔) │ └──────────────────────┬─────────────────────────────────────┘ │ ▼ top -l 1 -n 20 -o mem \ -stats pid,command,mem,cmprs │ ▼ awk で PID行以降を抽出 ┌────────────────────────────┐ │ pid command mem cmprs │ ← MEM列 = CMPRS込み └────────────┬───────────────┘ │ プロセスごとにループ ▼ ┌─────────────────────────────────────────────┐ │ NEVER TOUCH に含まれる? │ │ kernel task / WindowServer / launchd / Finder │ │ YES → スキップ │ └──────────────────────┬──────────────────────┘ │ NO ▼ ┌──────────────────────────────────────────────┐ │ AUTO RESTART NAMES に含まれる?(dasd) │ │ かつ MEM ≥ 5120MB │ │ かつ クールダウン未満(30分)でない │ │ YES → sudo killall / launchd が自動復活 │ └──────────────────────┬───────────────────────┘ │ NO ▼ ┌──────────────────────────────────────────────┐ │ LAUNCHD RESTART MAP に含まれる?(iii) │ │ かつ MEM ≥ 2048MB │ │ YES → TERM → 2秒待ち → KILL │ │ → kickstart -k │ └──────────────────────┬───────────────────────┘ │ NO ▼ ┌──────────────────────────────────────────────┐ │ MEM ≥ 6144MB │ │ YES → Discord通知のみ(触らない) │ └──────────────────────────────────────────────┘ │ 全プロセス処理後 ▼ findings があれば Discord通知 swap使用量を添付