Claude Code Memory Leak - Process Grows to 120+ GB RAM and Gets OOM Killed
Description
Claude Code has a severe memory leak that causes the process to grow to over 120GB of RAM before being killed by the Linux OOM killer. This happens consistently during extended coding sessions, approximately every 30-60 minutes of active use.
Environment
- Claude Code Version: 1.0.53
- OS: Ubuntu 24.04
- Kernel: Linux 6.14.11
- Total System RAM: 128GB
- Installation Method: Direct installation in home directory
Steps to Reproduce
- Start Claude Code in interactive mode
- Use it for an extended coding session (30-60 minutes)
- Perform typical operations: file reading, editing, searching, running bash commands
- Monitor memory usage with
ps aux | grep claude
- Process will gradually consume all available RAM until OOM killed
Expected Behavior
Claude Code should maintain stable memory usage throughout the session, not exceeding a reasonable amount (e.g., 1-2GB for typical usage).
Actual Behavior
The claude process memory usage grows unbounded until it consumes all available system RAM (120+ GB) and triggers the OOM killer.
Evidence
OOM Kill Log Entries (from dmesg):
Killed process 1983785 (claude) total-vm:234427056kB, anon-rss:124857720kB, file-rss:0kB, shmem-rss:0kB, UID:XXXX pgtables:267248kB oom_score_adj:0
Killed process 1991601 (claude) total-vm:234453364kB, anon-rss:125118596kB, file-rss:596kB, shmem-rss:0kB, UID:XXXX pgtables:267880kB oom_score_adj:0
Killed process 1997049 (claude) total-vm:234463420kB, anon-rss:125275392kB, file-rss:5856kB, shmem-rss:0kB, UID:XXXX pgtables:269168kB oom_score_adj:0
Killed process 2001723 (claude) total-vm:234420884kB, anon-rss:119597028kB, file-rss:3748kB, shmem-rss:0kB, UID:XXXX pgtables:257104kB oom_score_adj:0
Killed process 2009167 (claude) total-vm:234464008kB, anon-rss:120216960kB, file-rss:372kB, shmem-rss:0kB, UID:XXXX pgtables:252260kB oom_score_adj:0
Key observations:
- total-vm consistently around 234GB (virtual memory)
- anon-rss (actual RAM used) between 119-125GB
- Multiple OOM kills in the same session indicate this is a recurring issue
- Memory consumption appears to be primarily anonymous pages (anon-rss), not file-backed
Impact
This memory leak makes Claude Code unusable for extended coding sessions as it:
- Causes system-wide memory exhaustion
- Triggers OOM killer which terminates other processes
- Loses session context when Claude is killed
- Requires frequent restarts, disrupting workflow
Additional Information
- The memory growth appears gradual over time, not sudden
- The issue persists across multiple sessions
- After OOM kill and restart, memory usage starts low (~400MB) and grows again
Potential Debugging Steps
To help diagnose this issue, the following information might be useful:
- Memory profiling of the claude process
- Heap snapshots at various points during execution
- Tracking of any unbounded data structures (conversation history, file caches, etc.)
Workaround
Currently, the only workaround is to periodically restart Claude Code before memory exhaustion occurs, which is highly disruptive to workflow.
Priority: High - This makes the tool unusable for its intended purpose of extended coding assistance
Claude Code Memory Leak - Process Grows to 120+ GB RAM and Gets OOM Killed
Description
Claude Code has a severe memory leak that causes the process to grow to over 120GB of RAM before being killed by the Linux OOM killer. This happens consistently during extended coding sessions, approximately every 30-60 minutes of active use.
Environment
Steps to Reproduce
ps aux | grep claudeExpected Behavior
Claude Code should maintain stable memory usage throughout the session, not exceeding a reasonable amount (e.g., 1-2GB for typical usage).
Actual Behavior
The claude process memory usage grows unbounded until it consumes all available system RAM (120+ GB) and triggers the OOM killer.
Evidence
OOM Kill Log Entries (from
dmesg):Key observations:
Impact
This memory leak makes Claude Code unusable for extended coding sessions as it:
Additional Information
Potential Debugging Steps
To help diagnose this issue, the following information might be useful:
Workaround
Currently, the only workaround is to periodically restart Claude Code before memory exhaustion occurs, which is highly disruptive to workflow.
Priority: High - This makes the tool unusable for its intended purpose of extended coding assistance