[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.
This issue has 14 comments on GitHub. Read the full discussion on GitHub ↗