[BUG] Linux Native x64 build - unbounded memory leak even with clean session

Status Closed — not planned
Maintainer reply None cached
Activity 14 comments · opened Dec 3, 2025 · closed Mar 27, 2026

Preflight Checklist

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

What's Wrong?

Bug Report: Memory Leak in Claude Code v2.0.56 (Native Binary)

Title

Severe memory leak in Claude Code native binary - consumes all available RAM from startup

Environment

| Component | Value |
|---------------------|---------------------------------------------------------|
| Claude Code Version | 2.0.56 |
| Installation Method | Native binary (ELF x86-64) |
| Binary Path | /home/worker/.local/share/claude/versions/2.0.56 |
| Binary MD5 | 0e1cf4775d5e2da4a4768436a23d9804 |
| Build ID | 3f1c142d4ee369512790723d9eb81539dcfdf9dd |
| OS | Ubuntu 22.04.5 LTS (Jammy Jellyfish) |
| Kernel | 6.8.0-87-generic #88~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC |
| Architecture | x86_64 |
| CPU | Intel Core i7-8650U @ 1.90GHz (8 cores, 2 threads/core) |
| Total RAM | 32 GB |
| Swap | 2 GB |

Shared Libraries

linux-vdso.so.1
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6
/lib64/ld-linux-x86-64.so.2
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6

Description

Starting Claude Code initiates a continuous memory leak that steadily consumes RAM regardless of conversation activity. The process will eventually exhaust all physical memory if left running.

Observed Behavior

After ~4 minutes of runtime with minimal conversation:

| Metric | Value |
|-------------------------|-------------------------|
| RSS (Resident Set Size) | 14.5 GB (and growing) |
| Virtual Memory Size | 74.7 GB |
| Peak Virtual Memory | 135.5 GB |
| VmData (heap/data) | 69.9 GB |
| Anonymous Memory | 15.3 GB |
| Private Dirty Pages | 15.3 GB |
| CPU Usage | 89-93% |
| Threads | 19 |
| Memory Mappings | 4,173 anonymous regions |

Key Observations

  1. Leak starts immediately - Memory begins growing from process start, not triggered by specific actions
  2. Steady growth - Memory consumption increases continuously over time
  3. Minimal activity - Leak occurs even with no significant conversation history or tool usage
  4. Anonymous memory dominant - 4,173 anonymous memory mappings indicate runaway heap allocations
  5. High CPU correlates - Process consumes 90%+ CPU alongside memory growth

Expected Behavior

Memory usage should remain relatively stable during idle periods or scale modestly with conversation context size.

Actual Behavior

Memory grows continuously from ~500MB at startup to multiple gigabytes within minutes, eventually consuming all available RAM.

Impact

  • Severity: Critical
  • System becomes unresponsive as memory is exhausted
  • Requires manual process termination
  • Makes Claude Code unusable for extended sessions

Additional Context

The 4,173 anonymous memory mappings (vs 6 mappings each for shared libraries) strongly suggests unbounded heap allocation - possibly a loop creating objects without cleanup, or a growing data
structure that's never freed.

What Should Happen?

Claude should stabilize it's VRAM allocation after a few minutes, and definitely shouldn't grow without bounds in a brand new process (just running claude in the terminal).

Error Messages/Logs

Steps to Reproduce

Steps to Reproduce

  1. Install Claude Code v2.0.56 native binary on Ubuntu 22.04
  2. Launch claude from terminal
  3. Monitor memory with htop or watch -n1 'ps -p $(pgrep claude) -o rss,vsz'
  4. Observe RSS growing steadily without user interaction

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.0.55

Claude Code Version

2.0.56

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

Configuration

~/.claude/settings.json:
{
"alwaysThinkingEnabled": false
}

Install stats (from ~/.claude.json):

  • Install method: native
  • Number of startups: 152
  • Auto-updates: disabled

Workarounds Attempted

None effective - the leak appears fundamental to the process execution.

View original on GitHub ↗

14 Comments

github-actions[bot] · 9 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/11315
  2. https://github.com/anthropics/claude-code/issues/4953
  3. https://github.com/anthropics/claude-code/issues/12327

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

Hyohko · 9 months ago

It's not just Claude Code by itself - even running claude update without entering the interactive console prompts this leak. After one minute here's htop:

<img width="1897" height="798" alt="Image" src="https://github.com/user-attachments/assets/e600029e-65b0-473a-9bf0-6aad2e98095a" />

Hyohko · 9 months ago

What's now more distressing is that I got a brand new copy of the Claude Code Native installer fresh from the claude website today, started running it, and I'm getting the exact same memory leak:

<img width="2094" height="706" alt="Image" src="https://github.com/user-attachments/assets/f8799106-8ad4-4b98-99bb-0231b7725f65" />

Hyohko · 9 months ago

Last screenshot - box locked up completely shortly after this was taken and I had to forcibly reboot:

<img width="2069" height="761" alt="Image" src="https://github.com/user-attachments/assets/c0d540d7-a44e-497e-b49f-f40a18aad64e" />

github-actions[bot] · 7 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

bushidoleg · 7 months ago

+1 Confirming on:

  • Ubuntu 22.04.5 LTS (Kernel 6.8.0-90-generic)
  • Claude Code 2.0.76
  • Node.js v20.19.5

RSS: ~3GB within 18 seconds. MCP disabled, issue persists.

marcindulak · 7 months ago

Ubuntu 24.04 - claude update alone (from version 2.0.74) uses over 11GB of resident memory.

claude update
Current version: 2.0.74
Checking for updates...

It Successfully updated from 2.0.74 to version 2.1.12 after running for almost 10 minutes.

Such high memory usage happens even when freshly installing claude.
Interestingly I don't reproduce this high memory usage of claude install inside github actions https://github.com/marcindulak/claude-install-memory-usage.

<img width="1065" height="235" alt="Image" src="https://github.com/user-attachments/assets/a69ff597-b27d-4a70-8e6f-6e90f3b0b26f" />

hussam-alhassan · 7 months ago

I'm facing this issue as well. Upon launching CC, RAM usage climbs to over 12GB in at most ~5 minutes, and then gets killed. I tested this several times and it happens regardless of whether I issue any prompts.

  • Claude Code 2.1.7 native binary (~/.local/share/claude/versions/2.1.7)
  • Arch Linux 6.18.3-arch1-1
  • Intel i5-1145G7 + 16GB RAM

I should note that this doesn't happen on WSL for me.

  • Claude Code 2.1.15
  • Node v2.1.15
AlexanderVott · 7 months ago
  • Claude Code version: 2.1.14
  • OS: Windows 10 22H2 (build 19045)
  • CPU: AMD Ryzen 7 5700X 8-Core
  • RAM: 48 GB
  • GPU: NVIDIA GeForce RTX 2070 SUPER
  • Node.js: v24.13.0
  • Bun: 1.3.5

Two claude.exe processes consumed extreme virtual memory:

  • PID 39916: 36 GB virtual memory
  • PID 6296: 31 GB virtual memory
  • Unity.exe: 9.6 GB (for reference)

Total: ~67 GB virtual memory from Claude processes alone.
The memory exhaustion triggered a Windows Desktop Window Manager (dwm.exe) crash

or

Crash message: To send a redacted crash report to Bun's team, please file a GitHub issue using the link below.....

janfrederik · 7 months ago

Confirming on

  • Claude Code version: 2.1.27
  • OS: Ubuntu Linux (kernel 6.14.0-37-generic)
  • System RAM: 32 GB
  • Plugins enabled:
  • context7@claude-plugins-official
  • superpowers@claude-plugins-official
  • basedpyright-lsp@flaks-claude-code-plugins

See #22188

1337hero · 6 months ago

I am confirming this bug exists on 2.1.29 - I've been experiencing it since 2.1.24 and onwards

  • Claude Code version 2.1.29
  • OS: Arch Linux (kernel 6.18.7-zen1-1-zen)
  • System RAM: 128gb
  • Plugins enabled:
  • superpowers@claude-plugins-official
  • ralph-loop@claude-plugins-official
marcindulak · 6 months ago

The problem with high memory usage during install in a fresh virtual machine (no use of code at all yet) is still present in 2.1.39 with the 2.1.59 installer: curl -fsSL https://claude.ai/install.sh | bash -s stable. The installation freezes the virtual machine (Almalinux/9 in Vagrant/VirtualBox), without installation succeeding.

<img width="1181" height="378" alt="Image" src="https://github.com/user-attachments/assets/fa4ac689-daef-4976-a4d1-b3ee82a608e9" />

github-actions[bot] · 5 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] · 4 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.