Skip to content

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

Closed as not planned

Description

@Hyohko

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?

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.

Activity

  1. github-actions commented on Dec 3, 2025

    @github-actions

    Found 3 possible duplicate issues:

    1. Critical Memory Leak: Claude Code Consumed 129GB RAM and Caused System Freeze #11315
    2. Claude Code Memory Leak - Process Grows to 120+ GB RAM and Gets OOM Killed #4953
    3. [BUG] Severe Memory Leak (20GB+) #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

  2. Hyohko commented on Dec 3, 2025

    @Hyohko
    Author

    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:

    Image
  3. Hyohko commented on Dec 3, 2025

    @Hyohko
    Author

    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:

    Image
  4. Hyohko commented on Dec 3, 2025

    @Hyohko
    Author

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

    Image
  5. github-actions commented on Jan 4, 2026

    @github-actions

    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.

  6. bushidoleg commented on Jan 12, 2026

    @bushidoleg

    +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.

  7. marcindulak commented on Jan 17, 2026

    @marcindulak

    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.

    Image
  8. hussam-alhassan commented on Jan 18, 2026

    @hussam-alhassan

    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
  9. AlexanderVott commented on Jan 22, 2026

    @AlexanderVott
    • 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.....

  10. janfrederik commented on Jan 31, 2026

    @janfrederik

    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

  11. 1337hero commented on Feb 2, 2026

    @1337hero

    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
  12. marcindulak commented on Feb 26, 2026

    @marcindulak

    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.

    Image
  13. github-actions commented on Mar 27, 2026

    @github-actions

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

  14. github-actions commented on Apr 4, 2026

    @github-actions

    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.

  15. locked as resolved and limited conversation to collaborators on Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions