Critical Memory Leak: Claude Code Consumed 129GB RAM and Caused System Freeze
Critical Memory Leak: Claude Code Consumed 129GB RAM and Caused System Freeze
Summary
Claude Code experienced a severe memory leak that consumed 129GB of virtual memory, exhausted all available system RAM (16GB), and caused a complete system freeze requiring a hard reboot.
Environment
- Claude Code Version: 2.0.36
- OS: Ubuntu 24.04.3 LTS
- Kernel: 6.14.0-35-generic
- Total RAM: 16GB
- CPU: 12 cores
- GPU: NVIDIA GeForce GTX 1070
Incident Details
Timeline (from sysstat data)
11:00:10 AM - Memory used: 11.17% (11 GB free)
11:10:08 AM - Memory used: 19.63% (8.5 GB free)
11:20:10 AM - Memory used: 55.87% (5.5 GB free) <- Rapid increase
11:30:10 AM - Memory used: 78.34% (1.1 GB free) <- Critical
11:33:16 AM - LINUX RESTART (complete system freeze)
Memory consumption increased from ~2GB to ~12GB in just 30 minutes, with no other resource-intensive applications running.
Process Memory Statistics (Post-Restart)
Name: claude
Pid: 3740
VmPeak: 135508316 kB (129 GB!)
VmSize: 75721528 kB (72 GB)
VmHWM: 569132 kB (556 MB peak resident)
VmRSS: 425416 kB (415 MB current resident)
VmData: 71003864 kB (68 GB data segment)
Threads: 19
Symptoms
- Gradual memory consumption over ~30 minutes
- Virtual memory peaked at 129GB (8x available physical RAM)
- System became completely unresponsive
- No kernel panic or OOM killer activation - just a hard freeze
- No swap usage (swap was at 0B throughout)
- Required hard power reset
System Logs
No warnings or errors before the freeze - the system just stopped logging at 11:31:19 AM. This indicates a complete kernel/hardware lockup due to memory exhaustion.
Last Activity Before Freeze
Nov 09 11:31:19 nick-System-Product-Name anacron[5742]: Normal exit (0 jobs run)
[No further logs until forced reboot at 11:33:16]
Expected Behavior
Claude Code should:
- Have reasonable memory bounds
- Implement memory management/garbage collection
- Not consume more than a few GB of RAM during normal operation
- Release memory when not actively processing
Actual Behavior
- Virtual memory ballooned to 129GB
- Physical memory consumption grew from ~2GB to ~12GB in 30 minutes
- System froze completely with no recovery possible
Reproduction
Unknown - this occurred during normal Claude Code usage. User reports this has happened multiple times.
Impact
- Severity: Critical
- Complete system lockup
- Data loss risk (requires hard reboot)
- System unusable until reboot
Additional Context
After reboot, the Claude Code process still shows 72GB virtual memory allocation, suggesting the leak condition persists and could recur at any time.
Suggested Investigation
- Memory profiling of the Claude Code process
- Check for circular references or unreleased resources
- Review context/conversation history storage (might be accumulating)
- Check if there's unbounded caching
- Review event listener cleanup
Workaround
Currently monitoring with: watch -n 1 'ps aux --sort=-%mem | head -5'
Plan to restart Claude Code when memory usage exceeds safe threshold.
64 Comments
Hello guys! Isn't there a permanent fix for this issue? Or a workaround?
I'm experiencing this as well.
Also experiencing this, Debian 13. Same symptoms and issue as described in original post. Has happened to me 20+ times, and frequently happens when calling subtasks or when working with multiple CC agents at once.
Experiencing this as well. It's taking down other services on my Ubuntu server with 64gb of RAM.
Same issue here. It usually happened when I restarted cursor with multiple windows of different projects opened, that had a claude session running. Seems claude tries to restore the session and then runs into a memory leak.
This is critical bug. Just installing claude code with command
curl -fsSL https://claude.ai/install.sh | bashfroze entire ec2t3.smallinstance (aws linux OS). It's no longer accessible using ssh unless rebooted.<img width="1593" height="507" alt="Image" src="https://github.com/user-attachments/assets/593c2c18-e674-43c4-a21c-0f34a3f69e1c" />
<img width="1564" height="719" alt="Image" src="https://github.com/user-attachments/assets/72a9b62e-0a02-4ed0-8c72-38d24b4ffd95" />
Same issue here with Version 2.0.61 (Claude Code), But it spiked to 11 GB, then dropped to 5 GB, then back to 200 MB (without any interaction) while normal usage (not installation)
Critical Memory Leak in Claude Code - Comprehensive Analysis
---
Executive Summary
Claude Code has a severe memory management bug that causes each process to allocate 26-129GB of virtual memory regardless of actual usage. On systems with 16GB RAM, this leads to:
This bug has been documented since July 2025 and remains unfixed as of December 2025.
---
The Problem Visualized
---
Exposed Symptoms
| Symptom | Severity | User Impact |
|:--------|:--------:|:------------|
| Swap fills to 100% | High | System becomes sluggish |
| Terminal freezes completely | Critical | Cannot Ctrl+C, no response |
| System hard-locks | Critical | Requires power cycle |
| Orphaned processes after crash | Medium | Manual cleanup required |
| Work loss from crashed sessions | High | Hours of context lost |
| False rate limit dialog appears | Medium | Precursor warning sign |
---
Critical Discovery: The Rate Limit → Freeze Chain
The Trigger Sequence
Evidence from GitHub Issue #4580
Process sampling during freeze shows V8 stuck in JSON serialization:
Strace output reveals pathological memory behavior:
Why False Rate Limits Matter
The rate limit dialog (even when incorrect) triggers defensive state serialization - Claude tries to save your work before a potential interruption. If your conversation context:
...then
JSON.stringify()enters an infinite-like recursion, consuming CPU and thrashing memory.Warning Signs (Observed Pattern)
/rate-limit-optionsdialog appears unexpectedlyIf you see this pattern: immediately run
/clearor kill the session before it freezes.---
Reproduction Case Study
System: Ubuntu 24.04 LTS, 16GB RAM, 4GB swap, kernel 6.8.0-88-generic
Claude Code Version: 2.0.64
Workload: 11 concurrent Claude Code sessions (normal development workflow)
Memory State When Frozen
Process Analysis
The Smoking Gun
Each Claude process shows:
This is not normal. A healthy Node.js application should have VSZ:RSS ratios of 2-5:1, not 50:1.
---
Related GitHub Issues
| Issue | Date | Title | Status |
|:------|:-----|:------|:------:|
| #8382 | Oct 2025 | 26GB allocation per process on 16GB system | Closed (dup) |
| #11315 | Nov 2025 | 129GB consumption, complete system freeze | Open |
| #11377 | Nov 2025 | 23GB RAM + 143% CPU after 14 hours | Open |
| #4953 | Aug 2025 | 120GB growth before OOM kill | Open |
| #10505 | Oct 2025 | 28GB from
--continue, 13GB swap | Open || #7020 | Sep 2025 | Sub-agent orchestration: 450MB → 30GB+ | Open |
| #3282 | Jul 2025 | Frozen at startup, memory leak | Open |
| #4580 | Jul 2025 | JSON serialization freeze at 100% CPU | Open |
| #12542 | Nov 2025 | False rate limit at <50% actual usage | Closed (dup) |
Pattern: Every issue involves massive virtual memory allocation disproportionate to actual usage.
New Pattern Identified: False rate limit → state serialization → JSON.stringify freeze → memory thrash → system lock.
---
Root Cause Analysis
Primary Issue: Unbounded Virtual Memory Reservation
Claude Code (or its dependencies) is calling
mmap()or equivalent with massive size requests without corresponding memory usage. This creates huge virtual address space reservations that:Likely Code Locations
Based on the symptoms, investigate these areas:
Evidence Supporting Each Theory
| Theory | Supporting Evidence |
|:-------|:-------------------|
| V8 Heap | VSZ grows unbounded;
--max-old-space-sizeworkaround helps || Task() Agents | Issue #8382 specifically triggered by parallel Task() calls |
| History Cache | Issue #12221 mentions 500+ sessions, 488MB conversation data |
| Native Modules | Gap between VSZ and RSS suggests non-JS allocations |
| Worker Threads | 19 threads reported in Issue #11315 process stats |
| JSON Serialization | CONFIRMED: #4580 shows 2000+ recursive stringify calls, 98% CPU in munmap |
---
What Needs to Be Fixed
For Anthropic Engineers
Immediate Architectural Recommendations
--max-old-space-sizeto CLI launcher - Simple, immediate impact---
Real Workarounds (Until Fixed)
These are actual technical mitigations, not "just restart constantly":
1. Limit Node.js Heap (Most Effective)
2. Install earlyoom (Prevents Hard Freeze)
3. Enable zswap (Compressed RAM-backed Swap)
4. cgroups Memory Limit (Hard Cap)
5. Increase OOM Priority (Die First, Save System)
6. Monitor and Auto-Kill Script
7. Malloc Tuning (Reduces Thrashing - from Issue #4580)
This reduces the 98% CPU spent on
munmapcalls but doesn't fix the root cause.8. Emergency Response: When Rate Limit Dialog Appears
If you see
/rate-limit-optionsand you're not near your limit:---
Recommended System Configuration
For systems running Claude Code regularly:
| Setting | Recommended | Why |
|:--------|:------------|:----|
| RAM | 32GB+ | Each session can spike to 2-4GB RSS |
| Swap | 8-16GB | Buffer for memory spikes |
| zswap | Enabled (lz4) | 3x effective swap, faster access |
| earlyoom | Installed | Prevents hard freeze |
| vm.swappiness | 10 | Prefer RAM, swap only when needed |
| NODE_OPTIONS |
--max-old-space-size=4096| Hard cap on V8 heap |---
Call to Action
For Anthropic:
For Users:
---
Appendix: Commands for Diagnosis
---
Report compiled: December 2025
Last updated: 2025-12-10
Environment: Ubuntu 24.04 LTS (kernel 6.8.0-88-generic), Claude Code v2.0.64
I started running out of diskspace as it filled it's virutal memory to 74gb per claude instance. this is clearly wrong.
I'm having similar issue on 2.1.2. Short session with python and pip bash commands and system locked down from ~500mb which spike quickly. Cloudflare container standard-1 instance.
I am having similar issue, it is persistent on all versions, I am on archlinux
Same issue, debian.
Seeing 72gb in WSL2
<html>
<body>
<!--StartFragment--><h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Same issue on WSL2 with Multi-Root Workspace - Detailed diagnosis</h2>
<h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">Environment</h3>
<ul class="[li_&]:mb-0 [li_&]:mt-1 [li_&]:gap-1 [&:not(:last-child)_ul]:pb-1 [&:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3">
<li class="whitespace-normal break-words pl-2"><strong>Claude Code Version</strong>: 2.1.9 (VS Code extension)</li>
<li class="whitespace-normal break-words pl-2"><strong>OS</strong>: Windows 11 + WSL2 Ubuntu 24.04</li>
<li class="whitespace-normal break-words pl-2"><strong>Kernel</strong>: 6.6.87.2-microsoft-standard-WSL2</li>
<li class="whitespace-normal break-words pl-2"><strong>RAM</strong>: 16GB physical, 12GB allocated to WSL2, 16GB swap</li>
<li class="whitespace-normal break-words pl-2"><strong>inotify limit</strong>: Already set to 524,288</li>
</ul>
<h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">Workspace Configuration</h3>
<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Multi-root workspace with 4 projects totaling <strong>157,550 files</strong>:</p>
<ul class="[li_&]:mb-0 [li_&]:mt-1 [li_&]:gap-1 [&:not(:last-child)_ul]:pb-1 [&:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3">
<li class="whitespace-normal break-words pl-2">React Native app (local): 110,480 files (mostly node_modules)</li>
<li class="whitespace-normal break-words pl-2">WordPress site (SSHFS mount): 47,070 files</li>
<li class="whitespace-normal break-words pl-2">2 small utility folders: ~80 files</li>
</ul>
<h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">Observed Behavior</h3>
<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">When opening the multi-root workspace and starting a Claude Code conversation:</p>
<ul class="[li_&]:mb-0 [li_&]:mt-1 [li_&]:gap-1 [&:not(:last-child)_ul]:pb-1 [&:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3">
<li class="whitespace-normal break-words pl-2">Memory immediately spikes to <strong>11GB RSS / 82GB+ VSZ</strong></li>
<li class="whitespace-normal break-words pl-2">System reaches <strong>98% memory usage</strong> within seconds</li>
<li class="whitespace-normal break-words pl-2">Swap usage climbs to 4-5GB</li>
<li class="whitespace-normal break-words pl-2">Extension crashes with "Reload Window" prompt</li>
</ul>
<div class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg"><div class="sticky opacity-0 group-hover/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex
items-center
justify-center
relative
shrink-0
can-focus
select-none
disabled:pointer-events-none
disabled:opacity-50
disabled:shadow-none
disabled:drop-shadow-none border-transparent
transition
font-base
duration-300
ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md active:scale-95 backdrop-blur-md Button_ghost__BUAoh" type="button" aria-label="Copier dans le presse-papiers" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="transition-all opacity-100 scale-100" aria-hidden="true" style="flex-shrink: 0;"><path d="M12.5 3C13.3284 3 14 3.67157 14 4.5V6H15.5C16.3284 6 17 6.67157 17 7.5V15.5C17 16.3284 16.3284 17 15.5 17H7.5C6.67157 17 6 16.3284 6 15.5V14H4.5C3.67157 14 3 13.3284 3 12.5V4.5C3 3.67157 3.67157 3 4.5 3H12.5ZM14 12.5C14 13.3284 13.3284 14 12.5 14H7V15.5C7 15.7761 7.22386 16 7.5 16H15.5C15.7761 16 16 15.7761 16 15.5V7.5C16 7.22386 15.7761 7 15.5 7H14V12.5ZM4.5 4C4.22386 4 4 4.22386 4 4.5V12.5C4 12.7761 4.22386 13 4.5 13H12.5C12.7761 13 13 12.7761 13 12.5V4.5C13 4.22386 12.7761 4 12.5 4H4.5Z"></path></svg></div><div class="absolute top-0 left-0 transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="absolute top-0 left-0 transition-all opacity-0 scale-50" aria-hidden="true" style="flex-shrink: 0;"><path d="M15.1883 5.10908C15.3699 4.96398 15.6346 4.96153 15.8202 5.11592C16.0056 5.27067 16.0504 5.53125 15.9403 5.73605L15.8836 5.82003L8.38354 14.8202C8.29361 14.9279 8.16242 14.9925 8.02221 14.9989C7.88203 15.0051 7.74545 14.9526 7.64622 14.8534L4.14617 11.3533L4.08172 11.2752C3.95384 11.0811 3.97542 10.817 4.14617 10.6463C4.31693 10.4755 4.58105 10.4539 4.77509 10.5818L4.85321 10.6463L7.96556 13.7586L15.1161 5.1794L15.1883 5.10908Z"></path></svg></div></div></button></div></div><div><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed" style="background: transparent; color: rgb(171, 178, 191); text-shadow: rgba(0, 0, 0, 0.3) 0px 1px; font-family: var(--font-mono); direction: ltr; text-align: left; white-space: pre; word-spacing: normal; word-break: normal; line-height: 1.5; tab-size: 2; hyphens: none; padding: 1em; margin: 0.5em 0px; overflow: auto; border-radius: 0.3em;"><code style="background: transparent; color: rgb(171, 178, 191); text-shadow: rgba(0, 0, 0, 0.3) 0px 1px; font-family: var(--font-mono); direction: ltr; text-align: left; white-space: pre-wrap; word-spacing: normal; word-break: normal; line-height: 1.5; tab-size: 2; hyphens: none;"><span><span>USER PID %CPU %MEM VSZ RSS
</span></span><span>claude 995 194 91.1 98587860 11162396</span></code></pre></div></div>
<h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">Critical Finding: Non-linear memory explosion</h3>
<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">I ran isolation tests on each project separately:</p>
<div class="overflow-x-auto w-full px-2 mb-6">
Configuration | Files | Claude Code RAM | Result
-- | -- | -- | --
React Native alone | 110,480 | 470 MB | ✅ Stable
WordPress alone (SSHFS) | 47,070 | 480 MB | ✅ Stable
Both combined (multi-root) | 157,550 | 11 GB | ❌ CRASH
</div>
<h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">Key insight about <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">permissions.deny</code></h3>
<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">I configured <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">.claude/settings.local.json</code> with extensive deny rules:</p>
<div class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg"><div class="sticky opacity-0 group-hover/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex
items-center
justify-center
relative
shrink-0
can-focus
select-none
disabled:pointer-events-none
disabled:opacity-50
disabled:shadow-none
disabled:drop-shadow-none border-transparent
transition
font-base
duration-300
ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md active:scale-95 backdrop-blur-md Button_ghost__BUAoh" type="button" aria-label="Copier dans le presse-papiers" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="transition-all opacity-100 scale-100" aria-hidden="true" style="flex-shrink: 0;"><path d="M12.5 3C13.3284 3 14 3.67157 14 4.5V6H15.5C16.3284 6 17 6.67157 17 7.5V15.5C17 16.3284 16.3284 17 15.5 17H7.5C6.67157 17 6 16.3284 6 15.5V14H4.5C3.67157 14 3 13.3284 3 12.5V4.5C3 3.67157 3.67157 3 4.5 3H12.5ZM14 12.5C14 13.3284 13.3284 14 12.5 14H7V15.5C7 15.7761 7.22386 16 7.5 16H15.5C15.7761 16 16 15.7761 16 15.5V7.5C16 7.22386 15.7761 7 15.5 7H14V12.5ZM4.5 4C4.22386 4 4 4.22386 4 4.5V12.5C4 12.7761 4.22386 13 4.5 13H12.5C12.7761 13 13 12.7761 13 12.5V4.5C13 4.22386 12.7761 4 12.5 4H4.5Z"></path></svg></div><div class="absolute top-0 left-0 transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="absolute top-0 left-0 transition-all opacity-0 scale-50" aria-hidden="true" style="flex-shrink: 0;"><path d="M15.1883 5.10908C15.3699 4.96398 15.6346 4.96153 15.8202 5.11592C16.0056 5.27067 16.0504 5.53125 15.9403 5.73605L15.8836 5.82003L8.38354 14.8202C8.29361 14.9279 8.16242 14.9925 8.02221 14.9989C7.88203 15.0051 7.74545 14.9526 7.64622 14.8534L4.14617 11.3533L4.08172 11.2752C3.95384 11.0811 3.97542 10.817 4.14617 10.6463C4.31693 10.4755 4.58105 10.4539 4.77509 10.5818L4.85321 10.6463L7.96556 13.7586L15.1161 5.1794L15.1883 5.10908Z"></path></svg></div></div></button></div></div><div class="text-text-500 font-small p-3.5 pb-0">json</div><div><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed" style="background: transparent; color: rgb(171, 178, 191); text-shadow: rgba(0, 0, 0, 0.3) 0px 1px; font-family: var(--font-mono); direction: ltr; text-align: left; white-space: pre; word-spacing: normal; word-break: normal; line-height: 1.5; tab-size: 2; hyphens: none; padding: 1em; margin: 0.5em 0px; overflow: auto; border-radius: 0.3em;"><code class="language-json" style="background: transparent; color: rgb(171, 178, 191); text-shadow: rgba(0, 0, 0, 0.3) 0px 1px; font-family: var(--font-mono); direction: ltr; text-align: left; white-space: pre; word-spacing: normal; word-break: normal; line-height: 1.5; tab-size: 2; hyphens: none;"><span><span class="token" style="color: rgb(171, 178, 191);">{</span><span>
</span></span><span><span> </span><span class="token" style="color: rgb(224, 108, 117);">"permissions"</span><span class="token" style="color: rgb(97, 175, 239);">:</span><span> </span><span class="token" style="color: rgb(171, 178, 191);">{</span><span>
</span></span><span><span> </span><span class="token" style="color: rgb(224, 108, 117);">"deny"</span><span class="token" style="color: rgb(97, 175, 239);">:</span><span> </span><span class="token" style="color: rgb(171, 178, 191);">[</span><span>
</span></span><span><span> </span><span class="token" style="color: rgb(152, 195, 121);">"Read(./node_modules/)"</span><span class="token" style="color: rgb(171, 178, 191);">,</span><span>
</span></span><span><span> </span><span class="token" style="color: rgb(152, 195, 121);">"Read(./ios/Pods/)"</span><span class="token" style="color: rgb(171, 178, 191);">,</span><span>
</span></span><span><span> </span><span class="token" style="color: rgb(152, 195, 121);">"Read(./android/.gradle/)"</span><span class="token" style="color: rgb(171, 178, 191);">,</span><span>
</span></span><span><span> </span><span class="token" style="color: rgb(152, 195, 121);">"Read(./.expo/)"</span><span>
</span></span><span><span> </span><span class="token" style="color: rgb(171, 178, 191);">]</span><span>
</span></span><span><span> </span><span class="token" style="color: rgb(171, 178, 191);">}</span><span>
</span></span><span><span></span><span class="token" style="color: rgb(171, 178, 191);">}</span></span></code></pre></div></div>
<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>This does NOT prevent the memory leak.</strong> The deny rules only control what Claude can read during a conversation - they don't prevent the initial indexing/scanning that causes the memory explosion at startup.</p>
<h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">Workaround</h3>
<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The only solution that works is <strong>abandoning the multi-root workspace</strong> and using separate VS Code windows for each project. Each window stays stable at ~480 MB.</p>
<h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">Additional context</h3>
<ul class="[li_&]:mb-0 [li_&]:mt-1 [li_&]:gap-1 [&:not(:last-child)_ul]:pb-1 [&:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3">
<li class="whitespace-normal break-words pl-2">This worked fine on the morning of Jan 16, 2026 with the exact same workspace and version</li>
<li class="whitespace-normal break-words pl-2">Something changed (possibly server-side feature flag like <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">tengu_mcp_tool_search: true</code>) between morning and evening</li>
<li class="whitespace-normal break-words pl-2">The issue is 100% reproducible on every attempt with multi-root</li>
</ul>
<h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">Request</h3>
<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Could Anthropic investigate:</p>
<ol class="[li_&]:mb-0 [li_&]:mt-1 [li_&]:gap-1 [&:not(:last-child)_ul]:pb-1 [&:not(:last-child)_ol]:pb-1 list-decimal flex flex-col gap-1 pl-8 mb-3">
<li class="whitespace-normal break-words pl-2">Why multi-root indexing has non-linear memory scaling?</li>
<li class="whitespace-normal break-words pl-2">Why <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">permissions.deny</code> doesn't prevent initial file scanning?</li>
<li class="whitespace-normal break-words pl-2">Is there a way to limit indexing scope at startup?</li></ol><!--EndFragment-->
</body>
</html>
It just eats the whole memory!
The only thing I did was I ran claude in terminal and prompted greeting:
<img width="1478" height="717" alt="Image" src="https://github.com/user-attachments/assets/ebfc5791-bc96-49db-8fad-3776ba65f1f7" />
BTW, updating to latest 2.1.12 version (using npm rather than native installation) fixed the problem.
Now, just opening it consumes around ~200Mb
NPM version is deprecated https://code.claude.com/docs/en/setup#npm-installation-deprecated.
Moreover, fixing this type of bug would be normally mentioned in the CHANGELOG.
<img width="1331" height="322" alt="Image" src="https://github.com/user-attachments/assets/0dd62d73-de30-457a-b272-d7a7cb4a1d0b" />
Anyway
I've observed the same problem with 2.1.12 installed by the native installer.
Claude Code used more than 20+ GB memory at peak, which is unreasonable. I'm not sure how to reproduce it but noticed that it increased when generating responses and decreased to about 1 - 2 GB when idling.
For me was happening because some of my session logs became quite large (1-10GB) and Claude seemed to be trying to process them on start, in some cases freezing my whole system. Deleting these large files resolved the issue.
~/.claude/[project]/*.jsonlIn my case the culprit was the Playwright MCP, which was taking hundreds of screenshots and storing them in the jsonl as base64 data. Suggestion for the team: don't do that 😅
Uninstall + Reinstall and deleting big files (logs, db dumps) in my working directory fixed the memory leak for me.
having this issue as well on a fresh install on macos
claude -v
2.1.14 (Claude Code)
just run the claude command, no further actions required
and see the memory usage increase little by little nonstop
Still happens on 2.1.17.
Easy way to reproduce:
./gradlew assembleDebug(or any other command)It shouldn't use 20GB of memory just to observe the command output.
Pretty annoying, but here's a small workaround to clear Claude Code sessions in the background in case anyone finds it helpful!
https://github.com/anthropics/claude-code/issues/4953#issuecomment-3792297455
Same issue in version v2.1.23
Seeing something similar here. I left Claude idle on Ubuntu for 27 days.
The machine is a fan less i9 with 32 GB ram.
You can literally cook an egg on it while Claude is running idle. (lmk if you want video evidence)
When Claude is not running it just a little warm.
SWP: 96%
CPU: 102.7%
OS: Ubuntu 24
Process Details
Timeline
Impact Measurement
Same here. Updated to 2.1.44 and resumed older sessions earlier today and for some reason 2.1.15 shown up in activity monitor in MacOS and consumed monstrous amount of memory!!
I am experiencing this on both; My Macbook Pro machine M4 using Warp Terminal and also on my Linux Ubuntu machine using Ghostty. I can see how the memory usage keeps increasing with every new prompt. Is this a big context window problem beyond the terminal we are using or just kind of memory leak from Claude Code end?
@m-ret Intriguingly I wam using the same set up as you with Warp terminal + m4 Pro + Claude Code. Same issue!
Can confirm this being an issue with current version on windows with powershell - 64gb ram system and usage was over 47GB on just claude code.exe
Same thing.
Running Claude in Win Git Bash, since the recent update to 2.1.47, starting to observe idle sessions eating up all the available RAM, causing the PC to freeze.
Now, knowing Claude writes itself, should we somehow tag Claude to fix itself right from these issues? xD
This is a very good idea 😂
Same issue here, Linux Oracle 9 VM running on Win 11, 8GM of RAM allocated to the VM.
Claude VSCode plugin version 2.1.56
Claude code version 2.1.47
VSCode just gets killed on OOM error.
Same issue here.
Claude Code v2.1.58
SO: Microsoft Windows 11 Home Single Language
Version: 10.0.26200 build 26200
It increases very quickly — it reaches 1GB of RAM in just 30 seconds and continues without stopping.
Reposting https://github.com/anthropics/claude-code/issues/12987#issuecomment-3969148746. The high memory usage happens during
claudeinstallation on a fresh virtual machine, similarly to https://github.com/anthropics/claude-code/issues/11315#issuecomment-3614164935.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" />
I've also the same issue on :
Claude code 2.1.59
SO : Ubuntu 22
I've updated claude code to 2.1.62 to fix that
Evidence update (artifact re-check, 2026-03-04)
After re-parsing my watchdog artifact bundle, I need to correct one point in my earlier comment.
Confirmed in the panic artifact
Not confirmed for this specific crash
claude/anthropicprocess entry in the panic file./Volumes/Claudeand LaunchServices lookup messages forcom.anthropic.claude), but noclaude-codeprocess entries in the critical window.Conclusion (for this incident)
This crash is clearly a watchdog timeout under severe memory pressure, but from the available artifacts I cannot attribute direct causality to a running Claude Code process in the panic/Jetsam critical path.
Posting this correction for accuracy. If maintainers want, I can provide a scrubbed timestamp/process summary from the same artifact set.
I noted something. After I updated claude to last version, the ram consuption don't increase anymore, but where there is new claude update, it reappear. And also with claude --update, its ram usage increase too and take all my available ram. May be that is the point
hey man, Rishabh this side. I am building hawk for this exact same issue our mass of developers is facing. would love to connect and work around the fixes for your problem. you can find me at linkedin https://www.linkedin.com/in/rishabh-sain/
Are there any eyes from the team on this issue? This is making the program unusable. Is anyone looking at this?
Still seeing reports of this in 2026. The root cause is often orphaned subagents and MCP servers that survive session exit — each one holds 180-400 MB, and they compound across sessions throughout the day.
Built cc-reaper specifically for this. Three-layer defense:
kill -- -$PGID)claude-ramshows RAM/CPU breakdown per session + orphan category,claude-cleanupfor manual killsOn Ubuntu/Linux, the proc-janitor layer is especially important since there's no launchd — it runs as a background daemon and catches orphans from crashed sessions where no Stop hook fires.
Won't fix internal node.js memory leaks, but it prevents the multi-GB orphan process accumulation that triggers most OOM kills.
Same here:
RAM leak causes system freeze — possibly related to Playwright MCP plugin
After starting a Claude Code session, RAM usage grew linearly even with no user input,
eventually consuming ~8.5 GB out of 12 GB and pushing the system into swap. This froze the
laptop entirely.
After a restart, the same behavior occurred — memory climbed steadily without any interaction.
Running /plugin appeared to resolve the leak (RAM dropped from 3.3 GB to ~430 MB), possibly
triggering garbage collection.
System: 12 GB RAM, Linux Ubuntu
MCP plugin active: Playwright (npm exec @playwright)
Behavior: Linear memory growth with no user input
Workaround: Running /plugin stopped the leak mid-session
version: Claude Code v2.1.74
I found only one solution, disable the update until they fix it. It occurs only when installing or updating.
@Marc-Antoine-K Your Playwright MCP case is a textbook example of what cc-reaper's
claude-guardwas built for. MCP servers like Playwright spawn child processes that hold memory independently — when the parent session leaks or stalls, those children keep growing unchecked.With cc-reaper's RSS threshold reaper (
claude-guard), you can set a per-session memory ceiling:It calculates the full process tree RSS (session + all child MCP servers + subagents), so a Playwright process silently ballooning to 3 GB under a 430 MB parent session still gets caught. The kill uses PGID to take down the entire group cleanly — no orphaned Playwright processes left behind.
For your 12 GB system, I'd recommend:
claude-ramwill also show you per-category breakdown (MCP servers vs subagents vs core) so you can see exactly where the memory is going before it becomes a problem.Setup is one command:
git clone https://github.com/theQuert/cc-reaper.git && cd cc-reaper && bash install.shThe proc-janitor daemon layer is particularly useful on Linux — it catches orphans from crashed sessions where no Stop hook fires, scanning every 30s with a 60s grace period before cleanup.
Thank you so much for the thorough explanation! Great understanding of the issue and again thank you for letting me know!
for me, as @Marc-Antoine-K suggested, it seemed to be an issue with playwright mcp. I couldn't even run the /plugin command. Just calling
claudein the terminal was making my ubuntu to freeze completely requiring a hard reboot. I just disabled the playwright mcp withclaude plugin disable playwright@claude-plugins-officialand then reenabled again.After that, all seems to be working fine, for now.
Same issue:
Additional data: NtFC (NTFS File Cache) kernel NonPaged Pool leak on Windows 11
Environment
Observations
During a 38-minute Claude Code session, I monitored the kernel NonPaged Pool using performance counters. The pool grew linearly at ~5.9 GB/hour:
| Time | NonPaged Pool | Delta/5min | Free RAM |
|------|--------------|------------|----------|
| 11:01 | 4.93 GB | — | 6.20 GB |
| 11:06 | 5.40 GB | +0.47 GB | 5.60 GB |
| 11:11 | 5.90 GB | +0.50 GB | 4.91 GB |
| 11:15 | 6.31 GB | +0.41 GB | 4.80 GB |
| 11:20 | 6.79 GB | +0.48 GB | 3.88 GB |
| 11:25 | 7.21 GB | +0.42 GB | 4.68 GB |
| 11:30 | 7.66 GB | +0.45 GB | 4.94 GB |
| 11:35 | 8.20 GB | +0.54 GB | 3.76 GB |
| 11:39 | 8.66 GB | +0.46 GB | 3.69 GB |
Total: +3.73 GB in 38 minutes → ~5.9 GB/hour, perfectly linear.
Pool tag analysis
Using
poolmon-equivalent analysis, the NtFC tag (NTFS File Cache) is responsible for 86.7% of all NonPaged Pool usage:Key finding: 47 million allocations, only 485 frees. The NtFC entries are never released — they accumulate until reboot.
What I ruled out
I tested each of these during the active session — none stopped the leak:
D:\source,~\.claude,~\AppData\Roaming\Claude,~\AppData\Local\Temp) → leak unchangednode.exe,claude.exe→ leak unchangedRoot cause hypothesis
Claude Code's I/O pattern (rapid scanning, reading, and executing commands via node.exe) triggers a Windows kernel bug where NTFS File Cache entries (
NtFCpool tag) are allocated in NonPaged Pool but never freed. This is a kernel-space leak, not a userspace issue — it survives process termination and only clears on reboot.The
WdFilter(Defender minifilter) may amplify the issue by intercepting every I/O operation, but Defender exclusions alone don't fix it, suggesting the root cause is in ntfs.sys or the volume ofNtQueryDirectoryFileExcalls.Impact
On a 32 GB system, the NonPaged Pool reaches critical levels (~10 GB) within ~50 minutes of a Claude Code session, leading to system instability, heavy paging, and eventually BSOD (
PAGE_FAULT_IN_NONPAGED_AREA).Workaround
The only current workaround is periodic reboots during long Claude Code sessions. Defender exclusions and VPN service management may help prevent the leak from starting in fresh sessions (needs verification post-reboot).
Unfortunately at this time I just think this piece of software is unusable. A critical memory leaking bug that will absolutely hog your system to death and no one at the company would actually take a look at it because there are too many issues and too many spaghettis to even start a proper code audit. No QC, no review, nothing.
Yeah, "let Claude Code build itself", my ass lol
And updates on this? Claude Code just crashed my entire system again, this time consuming 370 GB (!!!) of virtual RAM.
I have a maxed-out MBP M4 Max, but it means nothing when CC starts to consume.
The worst thing is that sometimes, when building bigger features, I have 1-2 agents on for days, if not weeks, because I start planning with them, so they know the context of everything. And when I try to resume them later, the chats are gone, and I can't restore history anymore.
Unbelievable that this is still open 6 months after it was opened given how critical this issue is. I found an alternative - moved to Codex, it got too annoying.
This is becoming so annoying. Can't you ask your "famous" Mythos to fix this bug?
This happens to me even with a tiny conversation (~ 20 kB instructions in CLAUDE.md and ~ 20 mostly oneliner backs and forths). Claude Code, while sitting idle (!), allocating 50 MB/s of RAM.
I found temporary fix, disable claude self update, it occurs when claude update. at least using stable line for update
@/tmp/cc-reaper-comment-11315.md
In my case, I discovered that the real problem was Claude Desktop. Preventing Claude Desktop from automatically starting at system startup solved the problem. It seems that Claude Desktop consumes memory even when not in use, remaining idle.
On Linux, look into setting up
earlyoom. It's been a life saver for me to prevent lock-ups. I have mine configured to keep at least 5% of RAM available and with its--preferand--avoidarguments it can be pretty friendly.@Ilya0527 the graphics driver angle is interesting -- that's what another LLM (Sonnet 4.6 -- not sure what you are) also suggested after showing it my journalctl output from right before the freeze. However, I'm on AMD and Radeon with the open-source drivers.
I keep seeing large virtual memory size (https://github.com/anthropics/claude-code/issues/11315#issuecomment-3969231532) on an old Intel i5-6300U machine, with Intel integrated graphics. However, the resident memory usage appears lower since Claude version 2.1.1XX. The high resident memory usage behavior seems random (it always was random), now it does not even appear during Claude installation or update, so it's hard to make conclusions.
In the past OOM killer was not preventing a hard freeze of the machine, maybe the freeze was due to something else than memory? Therefore for the past several months I'm running Claude Code confined to a limited resource (16GB) virtual machine in Vagrant, to it freeze instead, and indeed every few days the machine is unrecoverable. Unfortunately, Vagrant itself is known for freezes, so again no conclusions, except the improvement that since February I had only one hard host system freeze.
I can confirm that I've seen much reduced resident memory usage too as of late 💐 I dug through the Claude Code changelog but couldn't spontaneously find a mention of memory-related fixes though.
On the other hand, people report resident memory still growing with 2.1.143 https://github.com/anthropics/claude-code/issues/4953#issuecomment-4488000838, and
claude updateitself being killed.Another attempt (
2.1.159 (Claude Code)) at an installation ofcurl -fsSL https://claude.ai/install.sh | bashon a fresh virtual machine (nothing under~/.claude) still caused resident memory RES to grow to over 11GB and virtual machine to freeze (like in https://github.com/anthropics/claude-code/issues/11315#issuecomment-3614164935), but the host laptop did not freeze. Also linked here https://github.com/anthropics/claude-code/issues/4953#issuecomment-4594991557.<img width="1178" height="294" alt="Image" src="https://github.com/user-attachments/assets/e5de93fb-cad5-4f26-99c9-72f5f76eb1a1" />
Literally have the same issue dude, on Fedora 44, it drove me insane. I code in Intellij and while coding i downloaded the thing and it completely freezed my pc, did it more times just to be sure and it took all of the ram and the OOM killed it, i cant even download the thing. !pastedfile_1.png
Same here,
claude --updateeats whole available memory during an update process. Update installed but memory usage is terrible.@SevenSystems
It was fixed in 2.1.160 according to the CHANGELOG.
I guess
claude --updatemessing up is a new bug.