claude-code - 💡(How to fix) Fix Memory leak in long-running session: RSS grows to 12+ GB within minutes (v2.1.143, WSL2) [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#60534Fetched 2026-05-20 03:56:05
View on GitHub
Comments
2
Participants
2
Timeline
10
Reactions
0
Author
Timeline (top)
labeled ×4commented ×2cross-referenced ×2closed ×1

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.

Root Cause

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.

Fix Action

Workaround

Exit and restart claude periodically.

RAW_BUFFERClick to expand / collapse

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.sh to ~/.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 elapsedRSS% of RAM
~1 min990 MB4.8%
~6 min6.4 GB31.4%
~12 min12.6 GB61.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

  1. Start claude in a project directory.
  2. Use normally — file reads, Bash tool calls, conversational turns.
  3. 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.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING