[BUG] Claude Code spawning multiple node 2GB processes, starving mac memory and triggering restart
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?
Claude Code spawning multiple node 2GB processes, starving mac memory and triggering restart, this when using multiple subagents and each triggering its own subtasks.
What Should Happen?
Claude should start each new node process with much less memory (ie. 256MB, 384MB, 512MB) if a particular process results in error, because of this, then run the process with the current default (2028MB).
Implemented:
- It works: in terminal, prior to running claude: export NODE_OPTIONS="--max-old-space-size=512”
Trying instead:
- Within claude code session, within each prompt: [your actual task here]. Use max-old-space-size=512 for node processes, retry at 2048 on OOM.
Error Messages/Logs
MACOS mac mini, runs out of memory, panics and restarts.
Steps to Reproduce
MAC Mini, with 16GB ram, run Claude Code tasks, out of plan mode, that spawns multiple parallel node processes, and each's sub-tasks spawn additional parallel node processes ... 2GB each ...
Claude Model
Opus
Is this a regression?
I don't know.
Last Working Version
Issue at least since 2.1.27, don't know if earlier (because I had not used plan mode before: prompting for parallel subagents, each with task tool generating subtasks).
Claude Code Version
2.1.30
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗