[BUG] Claude Code OOM Crash

Resolved 💬 3 comments Opened Jan 22, 2026 by pm0code Closed Jan 26, 2026

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?

Claude Code crashes with FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory during normal operation after ~64 seconds. V8 heap exhausts at 4GB limit, causing immediate termination without graceful shutdown.

Key Crash Indicators

  • Heap at Crash: 4042.1 MB (near 4GB V8 default limit)
  • Session Duration: 64.4 seconds before crash
  • GC Behavior: Mark-Compact thrashing, memory utilization dropped to 6.3%
  • Memory Recovered: Only 6.4 MB freed between final GC cycles
  • Impact: Immediate termination, no graceful shutdown

What Should Happen?

Not crash and use garbage collector or heap collector to remove old crap an doperate normally.

Error Messages/Logs

- **Heap at Crash**: 4042.1 MB (near 4GB V8 default limit)
- **Session Duration**: 64.4 seconds before crash
- **GC Behavior**: Mark-Compact thrashing, memory utilization dropped to 6.3%
- **Memory Recovered**: Only 6.4 MB freed between final GC cycles
- **Impact**: Immediate termination, no graceful shutdown

<--- Last few GCs --->

[33672:000002667D2A0000] 64472159 ms: Mark-Compact 4037.3 (4136.5) -> 4036.4 (4133.0) MB, pooled: 9 MB, 90.83 / 0.00 ms (average mu = 0.842, current mu = 0.299) allocation failure; scavenge might not succeed
[33672:000002667D2A0000] 64472314 ms: Mark-Compact 4043.5 (4138.9) -> 4042.1 (4151.9) MB, pooled: 9 MB, 145.49 / 0.00 ms (average mu = 0.615, current mu = 0.063) allocation failure; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

----- Native stack trace -----

1: 00007FF65B6970F7 node::SetCppgcReference+18039
2: 00007FF65B5FAA18 v8::base::CPU::num_virtual_address_bits+102920
3: 00007FF65C1FF151 v8::Isolate::ReportExternalAllocationLimitReached+65
4: 00007FF65C1EBCD6 v8::Function::Experimental_IsNopFunction+3302
5: 00007FF65C048420 v8::internal::StrongRootAllocatorBase::StrongRootAllocatorBase+33904
6: 00007FF65C044AAA v8::internal::StrongRootAllocatorBase::StrongRootAllocatorBase+19194
7: 00007FF65C05B08C v8::Isolate::GetHeapProfiler+8012
8: 00007FF65C05B90A v8::Isolate::GetHeapProfiler+10186
9: 00007FF65C0669F1 v8::Isolate::GetHeapProfiler+55473
10: 00007FF65C076746 v8::Isolate::GetHeapProfiler+120326
11: 00007FF65C07B558 v8::Isolate::GetHeapProfiler+140312
12: 00007FF65C066591 v8::Isolate::GetHeapProfiler+54353
13: 00007FF65C0720E1 v8::Isolate::GetHeapProfiler+102305
14: 00007FF65C1FC1E3 v8::String::NewFromUtf8+163
15: 00007FF65B47EE51 v8::CTypeInfoBuilder<__int64>::Build+17521
16: 00007FF65B47EC5D v8::CTypeInfoBuilder<__int64>::Build+17021
17: 00007FF65B47E955 v8::CTypeInfoBuilder<__int64>::Build+16245

Steps to Reproduce

Context: Large codebase (8,669 files) with multiple MCP servers and hooks configured.

  1. Configure hooks in .claude/settings.json:
  • UserPromptSubmit: custom analyzer script
  • PreToolUse: multiple custom validation scripts
  • PostToolUse: analyzer script (runs on every Read/Grep/Glob/Bash)
  1. Enable MCP servers:
  • Custom code search MCP (LanceDB vector index, 768-dim embeddings)
  • Custom architecture MCP (codebase analysis)
  • Custom database MCP (PostgreSQL queries)
  • gopls (Go workspace indexing)
  • context7 (library documentation)
  • Custom memory MCP (SQLite)
  1. Perform operations:
  • Database cleanup coordination (calls multiple MCP tools)
  • Codebase-wide searches (Grep/Glob on 8,669 files)
  • Read large documentation files (400+ files in docs/)
  • Agent task spawning (parallel execution)
  1. Session crashes with OOM after ~64 seconds

Note: Crash is non-deterministic but occurs frequently during heavy sessions.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.15

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗