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.
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
Incident Details
Timeline (from sysstat data)
Memory consumption increased from ~2GB to ~12GB in just 30 minutes, with no other resource-intensive applications running.
Process Memory Statistics (Post-Restart)
Symptoms
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
Expected Behavior
Claude Code should:
Actual Behavior
Reproduction
Unknown - this occurred during normal Claude Code usage. User reports this has happened multiple times.
Impact
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
Workaround
Currently monitoring with:
watch -n 1 'ps aux --sort=-%mem | head -5'Plan to restart Claude Code when memory usage exceeds safe threshold.