Memory leak: claude process reaches 18GB private memory in long session
Environment
- Claude Code version: latest (as of 2026-03-12)
- OS: Windows 10 Enterprise N LTSC 2019 (10.0.17763)
- Model: Claude Opus 4.6
- Session type: Long single session with context compaction
Description
After a long development session (several hours, one context compaction), the claude process accumulates massive private memory. The UI reports "High memory usage (13.5GB)" with a /heapdump suggestion.
Evidence
Process memory snapshot from Get-Process | Sort-Object WorkingSet64 -Descending:
| PID | Process | Working Set | Private Memory |
|-----|---------|------------|----------------|
| 41180 | claude | 1.1 GB | 18.2 GB |
| 20320 | claude | 1.1 GB | 5.9 GB |
| 17416 | claude | 0.9 GB | 4.5 GB |
Three claude processes consuming 28.6 GB combined private memory.
For comparison, the 61 node.exe processes (MCP servers, etc.) total only 0.6 GB.
Session characteristics
- Multiple large file reads (1000+ line Rust source files)
- Two background tasks with large stdout capture (collector process running for 30 minutes, output piped through
tee) - One context compaction mid-session
- 6 MCP servers connected (serena, windows-mcp, wrike, playwright, autoit, pywinauto)
- Multiple agent dispatches
Reproduction
Hard to give exact steps, but the pattern is: long session with many tool calls, large file reads, background tasks with large output, and context compaction. The memory grows monotonically and never reclaims.
Expected behavior
Memory should stay bounded. Even with full conversation history, the text content is maybe 10-20 MB. 18 GB private memory suggests objects are being retained that should be GC'd.
Notes
/heapdumpfailed with:EEXIST: file already exists, mkdir 'C:\Users\Sean\Desktop'- The Desktop folder already exists, so heapdump has a bug too
This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗