[Bug] Memory leak: claude.exe grows to 21GB+ on Windows during normal workflow with sub-agents
Environment
- OS: Windows 11 Home 10.0.26200
- Claude Code version: latest (March 2026)
- Shell: Git Bash (MSYS2)
- MCP servers enabled: pptx, xlsx, docx (COM automation)
Description
claude.exe consumes 21.7 GB RAM during a normal working session. The session involved switching to a project with moderate knowledge base files (~400KB text) and running 2 sub-agent (Agent tool) invocations (~250K tokens total).
Task Manager confirms only claude.exe (PID single process) is consuming the memory -- not Office apps or other MCP server processes.
"claude.exe","25940","Console","1","21,758,864 K"
Steps to Reproduce
- Open Claude Code with a project that has ~400KB of context files (CLAUDE.md + project state + knowledge base)
- Run 2-3 sub-agent invocations (Agent tool, ~100-150K tokens each)
- Observe RAM growth in Task Manager
Observed Behavior
- claude.exe RAM grows from normal (~300MB) to 21,758,864 KB (21.7 GB) within a single session
- RAM does not decrease after sub-agents complete
- System remains functional but heavily memory-constrained
Expected Behavior
RAM should stabilize or be garbage-collected after sub-agent results are returned.
Additional Context
This appears related to existing reports: #4953, #21378, #22188, #26528, #27421.
The issue may be exacerbated by:
- Sub-agent transcripts retained in Node.js heap
- V8 heap fragmentation from large JSON tool results
- MCP server connections (3 COM automation servers)
Reducing context window input (~30K tokens/session via lazy loading) did NOT resolve the issue, confirming the leak is at the Node.js/V8 layer, not the LLM context layer.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗