harnesslog.dev

Claude Code, AI, and development stories

EN · KO
H
hwangjungmin

Claude Code spawns a lot of child processes per session — MCP servers, subagents, headless Chromium instances, esbuild watchers. When a session ends normally, most get cleaned up. When it crashes or gets force-killed, they don’t. The parent is gone but the children keep running, quietly eating RAM.

There are GitHub issues showing heap growing to 93GB, or a single conversation window spawning two processes at 11.6GB each. Open and close multiple sessions throughout the day and it adds up fast.

zclean handles this two ways: a SessionEnd hook that fires right when Claude Code exits, and an hourly background scan that catches anything the hook missed. It only targets orphaned processes — active ones are left alone.

I run multiple Claude Code sessions on my Mac throughout the day. Memory was climbing in ways that were hard to track. After installing zclean, noticeably better.