[BUG] Desktop app: Claude Code background processes keep running after sessions end and push macOS into ~45 GB swap, hanging the Mac overnight
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
With the Claude desktop app open, processes spawned by Claude Code sessions keep running after the sessions stop issuing commands. Overnight with the lid closed they drove the Mac out of memory, and it hung.
- 22:41 lid closed. Swap used: 1.45 GB, memory pressure normal.
- 22:53 memory pressure critical.
- 23:29 swap used 46 GB, only 1.2 GB of swap space left.
- 23:49 to 03:18 about 186,000 jetsam kills of system daemons, each one respawning in 0 to 1 ms.
- 03:18 system hang (no panic). A power-button reset was required in the morning.
PowerLog per-coalition compressed-memory counter (CompressedLifetime) from 22:41 to 23:29:
com.anthropic.claudefordesktop: 4.18 GB to 105.81 GB (about 100 GB in 48 minutes)org.mozilla.firefox: 93 GB to 123 GB- every other coalition: under 10 GB
My last Claude Code session command ran at 22:12. Still alive in the Claude coalition after that:
- 3
claudeCLI processes uvpluspython3.13(a uvx-launched MCP server)- several
sshprocesses - a Chromium instance with 6 helpers, started at 22:25
- a shell loop spawning
sleepevery 5 minutes, plustail
The app also holds NoIdleSleepAssertion "Electron" while it is open.
What Should Happen?
Processes spawned by a session (MCP servers, Chromium, background shell loops) should be cleaned up when the session goes idle or ends, and should not grow memory without bound while the machine sits idle with the lid closed.
Error Messages/Logs
powerd: Entering Sleep state due to 'Clamshell Sleep' (22:53:52, one second after CriticalMemoryPressure)
launchd: [gui/501/com.apple.homed [47405]:] exited with exit reason (namespace: 1 code: 0xd) - OS_REASON_JETSAM, ran for 601ms, time-to-relaunch: 0ms
kernel: PMRD: No sleep wake failure string (after reboot; no panic report)
PowerLog SystemMemory 23:29:36: SwapUsedSize 46.04 GB, SwapAvailSize 1.2 GB, MemoryPressureLevel warn
Steps to Reproduce
Not reliably reproduced yet. Conditions when it happened:
- In the Claude desktop app (Code tab), run several Claude Code sessions in one repo with a uvx-launched MCP server (Home Assistant MCP) and a browser/Chromium tool.
- Let the sessions go idle. Don't quit the app.
- Close the lid overnight on AC power (16 GB RAM machine).
- Watch swap in PowerLog, or
sysctl vm.swapusage, grow within about an hour. The Mac is hung by morning.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
N/A
Claude Code Version
2.1.283 (Claude Code), Claude desktop app 2.9939.2
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
- The desktop app's Virtualization.framework VM, also in the Claude coalition, exited cleanly at 22:02, before the spike. On Sep 26 it was the largest process in two earlier JetsamEvent reports (2.27 GB each).
- PowerLog only records memory per coalition, so the specific process that grew is unknown. Chromium (started 22:25) and the MCP servers are the likely candidates.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗