Memory leak in long-running session: RSS grows to 12+ GB within minutes (v2.1.143, WSL2)
Summary
The claude CLI process exhibits rapid, unbounded memory growth during a single interactive session. RSS grew from ~900 MB to 12.6 GB in roughly 12 minutes of normal use, eventually exhausting available RAM and causing the system to swap.
Environment
- Claude Code: 2.1.143 (installed via official
install.shto~/.local/share/claude/versions/) - OS: Ubuntu 24.04.1 LTS on WSL2
- Kernel: Linux 5.15.167.4-microsoft-standard-WSL2
- RAM: 19 GiB total
- Shell: bash
Observed memory growth (single session, PID 56340)
| Time elapsed | RSS | % of RAM |
|--------------|--------|----------|
| ~1 min | 990 MB | 4.8% |
| ~6 min | 6.4 GB | 31.4% |
| ~12 min | 12.6 GB| 61.6% |
State stayed in R/Rl+ (actively running, not blocked on I/O). Exiting the session immediately released all memory. Starting a fresh session begins again at ~900 MB and grows similarly.
Also seen: runaway claude update
Separately, running claude update consumed 14.8 GB RSS over ~12 minutes before I killed it. It left behind a 0-byte versions/2.1.144 file. Possibly related (same allocation path?), possibly distinct.
Reproduction
- Start
claudein a project directory. - Use normally — file reads, Bash tool calls, conversational turns.
- Monitor with
ps -o pid,rss,pcpu,etime -p $(pgrep -f '^claude$').
Reported previously by me as occurring on 2.1.142 as well; the upgrade to 2.1.143 did not change behavior (yesterday's apparent "fix" was the restart, not the version bump).
Workaround
Exit and restart claude periodically.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗