claude-code - 💡(How to fix) Fix [BUG] Native memory leak (~1.5 GB/min RssAnon) in interactive mode — regression between 2.1.140 and 2.1.150

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…

Error Message

Error Messages/Logs

Fix Action

Fix / Workaround

  • Install: native build via claude.ai/install.sh (~/.local/bin/claude); the native binary ignores NODE_OPTIONS.
    • OS: Ubuntu, kernel 6.8.0-117-generic, x86_64; 16 GB RAM.
    • Terminal: Ptyxis (GTK4/VTE, Wayland); also reproduced inside tmux.
    • Asymmetry: same CLI runs fine headless on a 4 GB server with MANY stored sessions, while this 16 GB desktop with FEW sessions leaks → not session-count related.
    • Bisect: 2.1.140 (2026-05-12) clean; 2.1.150 (2026-05-23) leaks. CHANGELOG for 2.1.150 only says "Internal infrastructure improvements"; no memory entry in 2.1.154–2.1.156. The 2.1.153 fix ("excessive memory when resuming by transcript path on machines with many sessions") does NOT match this signature.
    • Workaround: pinned 2.1.140 + DISABLE_AUTOUPDATER=1.

Code Example

# /proc/<pid>/status — two snapshots ~45 s apart, idle/light use:
  RssAnon:   592xxx kB    RssFile: 111xxx kB
  RssAnon:  1731xxx kB    RssFile: 112xxx kB
  # NODE_OPTIONS=--max-old-space-size=512 → process still exceeds 3 GB (flag ignored)
  # Process OOM-killed (SIGKILL) once RSS reaches available RAM
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

In an interactive session the claude process RSS grows ~1.5 GB/min until it's OOM-killed (SIGKILL), freezing the desktop.

Measured via /proc/<pid>/status + smaps_rollup:

  • RssAnon climbs 592 MB → 1731 MB in 45 s (~1.5 GB/min); RssFile stays flat (~111 MB) → anonymous/private-dirty, NOT file-backed.
  • NODE_OPTIONS=--max-old-space-size=512 is IGNORED (process sails past 3 GB) → growth is NOT in the V8 JS heap; it's native/off-heap memory (native addon / ArrayBuffer / node-pty).
  • Reproduces in an EMPTY folder with a CLEAN CLAUDE_CONFIG_DIR (zero stored sessions) → not ~/.claude/projects accumulation.
  • Reproduces inside tmux → not specific to the terminal emulator.
  • The same CLI running headless (non-interactive) does NOT leak.

2.1.140 is stable (~315 MB, flat); 2.1.150 and 2.1.156 both leak. Likely related: #46931, #32752, #32892, #56335.

What Should Happen?

RSS should stay bounded (as in 2.1.140, ~315 MB, and in headless runs) instead of growing unbounded until OOM.

Error Messages/Logs

# /proc/<pid>/status — two snapshots ~45 s apart, idle/light use:
  RssAnon:   592xxx kB    RssFile: 111xxx kB
  RssAnon:  1731xxx kB    RssFile: 112xxx kB
  # NODE_OPTIONS=--max-old-space-size=512 → process still exceeds 3 GB (flag ignored)
  # Process OOM-killed (SIGKILL) once RSS reaches available RAM

Steps to Reproduce

  1. Native install (claude.ai/install.sh), version 2.1.150 or 2.1.156.
  2. Start in an empty dir with a clean config: mkdir -p /tmp/t && cd /tmp/t CLAUDE_CONFIG_DIR=/tmp/empty-cfg claude
  3. In another terminal, watch RSS: watch -n3 'grep -E "RssAnon|RssFile" /proc/$(pgrep -f claude|head -1)/status'
  4. RssAnon climbs ~1.5 GB/min; RssFile flat. Eventually OOM-killed. Also reproduces inside tmux. Does NOT reproduce on 2.1.140 (stays ~315 MB).

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.140

Claude Code Version

2.1.156 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

  • Install: native build via claude.ai/install.sh (~/.local/bin/claude); the native binary ignores NODE_OPTIONS.
    • OS: Ubuntu, kernel 6.8.0-117-generic, x86_64; 16 GB RAM.
    • Terminal: Ptyxis (GTK4/VTE, Wayland); also reproduced inside tmux.
    • Asymmetry: same CLI runs fine headless on a 4 GB server with MANY stored sessions, while this 16 GB desktop with FEW sessions leaks → not session-count related.
    • Bisect: 2.1.140 (2026-05-12) clean; 2.1.150 (2026-05-23) leaks. CHANGELOG for 2.1.150 only says "Internal infrastructure improvements"; no memory entry in 2.1.154–2.1.156. The 2.1.153 fix ("excessive memory when resuming by transcript path on machines with many sessions") does NOT match this signature.
    • Workaround: pinned 2.1.140 + DISABLE_AUTOUPDATER=1.

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

claude-code - 💡(How to fix) Fix [BUG] Native memory leak (~1.5 GB/min RssAnon) in interactive mode — regression between 2.1.140 and 2.1.150