[BUG] Claude Code crashes due to OOM
Environment
- Platform (select one):
- [ x ] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ x ] Other: Claude Code
- Claude CLI version: 1.0.10 (Claude Code)
- Operating System: MacOS 15.5
- Terminal: iTerm2
Bug Description
I'm getting the following error when it's generating code
<--- Last few GCs --->
[2579:0x128008000] 973483 ms: Mark-Compact 3777.2 (4137.3) -> 3761.1 (4137.0) MB, 37.21 / 0.00 ms (average mu = 0.373, current mu = 0.366) allocation failure; scavenge might not succeed [2579:0x128008000] 973545 ms: Mark-Compact 3777.5 (4137.5) -> 3761.7 (4137.8) MB, 39.21 / 0.00 ms (average mu = 0.372, current mu = 0.371) allocation failure; scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory ----- Native stack trace -----
1: 0x100bd20c4 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
2: 0x100d4fdd4 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
3: 0x100d4fd84 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
4: 0x100ee2e98 v8::internal::Heap::CallGCPrologueCallbacks(v8::GCType, v8::GCCallbackFlags, v8::internal::GCTracer::Scope::ScopeId) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
5: 0x100ee58e4 v8::internal::Heap::ComputeMutatorUtilization(char const*, double, double) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
6: 0x100ee3b40 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
7: 0x100ee19c8 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
8: 0x100ed9698 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
9: 0x100ed9e04 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
10: 0x100ec2d74 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
11: 0x1011d2bb4 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
12: 0x100a00c44 Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
13: 0x1088db104
14: 0x1086e7930
15: 0x100a23ee4 Builtins_ArrayMap [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
16: 0x1086e2550
17: 0x108811254
18: 0x108dd9054
19: 0x108a5d048
20: 0x108a8b85c
21: 0x108a9d17c
22: 0x108a20bb0
23: 0x108ce3700
24: 0x1009af210 Builtins_AsyncFunctionAwaitResolveClosure [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
25: 0x100a5cfb8 Builtins_PromiseFulfillReactionJob [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
26: 0x10099eb94 Builtins_RunMicrotasks [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
27: 0x1009763f4 Builtins_JSRunMicrotasksEntry [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
28: 0x100e6ec1c v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
29: 0x100e6f0ac v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
30: 0x100e905e0 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
31: 0x100e90414 v8::internal::MicrotaskQueue::PerformCheckpointInternal(v8::Isolate*) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
32: 0x100da7e80 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/opt/homebrew/Cellar/node@20/20.18.0_1/bin/node]
33: 0x100da79d8 v8::internal::MaybeHandlev8::internal::Object v8::internal::(anonymous namespace)::HandleApiCallHelper