[BUG] Linux Native x64 build - unbounded memory leak even with clean session
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
- Leak starts immediately - Memory begins growing from process start, not triggered by specific actions
- Steady growth - Memory consumption increases continuously over time
- Minimal activity - Leak occurs even with no significant conversation history or tool usage
- Anonymous memory dominant - 4,173 anonymous memory mappings indicate runaway heap allocations
- 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
- Install Claude Code v2.0.56 native binary on Ubuntu 22.04
- Launch claude from terminal
- Monitor memory with htop or watch -n1 'ps -p $(pgrep claude) -o rss,vsz'
- 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.
14 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
It's not just Claude Code by itself - even running
claude updatewithout entering the interactive console prompts this leak. After one minute here'shtop:<img width="1897" height="798" alt="Image" src="https://github.com/user-attachments/assets/e600029e-65b0-473a-9bf0-6aad2e98095a" />
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" />
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" />
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.
+1 Confirming on:
RSS: ~3GB within 18 seconds. MCP disabled, issue persists.
Ubuntu 24.04 -
claude updatealone (from version 2.0.74) uses over 11GB of resident memory.It
Successfully updated from 2.0.74 to version 2.1.12after 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" />
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.
I should note that this doesn't happen on WSL for me.
Two
claude.exeprocesses consumed extreme virtual memory: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.....
Confirming on
context7@claude-plugins-officialsuperpowers@claude-plugins-officialbasedpyright-lsp@flaks-claude-code-pluginsSee #22188
I am confirming this bug exists on 2.1.29 - I've been experiencing it since 2.1.24 and onwards
The problem with high memory usage during install in a fresh virtual machine (no use of
codeat 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" />
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
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.