[BUG] Claude Code JavaScript Heap Out of Memory Error
Resolved 💬 6 comments Opened Jun 18, 2025 by ephes Closed Jan 6, 2026
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.17 (Claude Code)
- Operating System: macOS 15.5
- Terminal: kitty
Bug Description
Claude Code crashes with a JavaScript heap out of memory error after running for an extended period (approximately 14.6 hours based on the GC timestamp).
Steps to Reproduce
- The error occurred after Claude Code had been running for approximately 52,593,403 ms (≈14.6 hours)
- The crash happened during normal operation while working in the <private> project
- The final operation attempted was reading a file using the filesystem API
Expected Behavior
Claude Code should handle long-running sessions without exhausting memory, potentially through:
- Periodic garbage collection
- Memory limit management
- Graceful handling of large file operations
Actual Behavior
The application crashes with SIGABRT when the JavaScript heap limit is reached.
Additional Context
Here's the traceback:
<--- Last few GCs --->
[45092:0x7fe630008000] 52593403 ms: Mark-Compact (reduce) 4344.4 (4491.8) -> 4343.8 (4348.6) MB, pooled: 0 MB, 132.40 / 0.00 ms (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 484 ms)
(average mu = 0.997,
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----
1: 0x10984bd41 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/usr/local/Cellar/node/24.1.0/bin/node]
2: 0x108514787 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/local/Cellar/node/24.1.0/bin/node]
3: 0x108514748 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/local/Cellar/node/24.1.0/bin/node]
4: 0x1086f10ff v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/Cellar/node/24.1.0/bin/node]
5: 0x1086ef740 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/Cellar/node/24.1.0/bin/node]
6: 0x1086e6a65 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/Cellar/node/24.1.0/bin/node]
7: 0x1086be558 v8::internal::MaybeHandle<v8::internal::SeqTwoByteString> v8::internal::FactoryBase<v8::internal::Factory>::NewRawStringWithMap<v8::internal::SeqTwoByteString>(int, v8::internal::Tagged<v8::internal::Map>,
v8::internal::AllocationType) [/usr/local/Cellar/node/24.1.0/bin/node]
8: 0x1086cf1dc v8::internal::Factory::NewStringFromUtf8(v8::base::Vector<unsigned char const>, unibrow::Utf8Variant, v8::internal::AllocationType) [/usr/local/Cellar/node/24.1.0/bin/node]
9: 0x10852b15a v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int) [/usr/local/Cellar/node/24.1.0/bin/node]
10: 0x108388747 node::fs::ReadFileUtf8(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/Cellar/node/24.1.0/bin/node]
11: 0x108eb267e Builtins_CallApiCallbackOptimizedNoProfiling [/usr/local/Cellar/node/24.1.0/bin/node]
fish: Job 1, '/Users/jochen/.claude/local/cla…' terminated by signal SIGABRT (Abort)
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗