claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Recurring crashes: JavaScript Heap Out of Memory while 'thinking'

Open rayozzie opened this issue 6 months ago • 55 comments

Bug Description Claude Code crashes on a recurring basis with "JavaScript heap out of memory" in the middle of thought. It is so common that I had never reported it, thinking that I wouldn't spam you. But in looking at github issues, I don't see it. Regrets if this is already well known.

It manifests itself several ways, and it happens both on my mac and on an ubuntu instance where I use claude. Here are several stack traces that I captured over the past 5 days.

• Implementing... (2340s • * 820 tokens • esc to interrupt)
>
? for shortcuts
Bypassing Permissions
<--- Last few GCs --->
[1452221:0xf1964ae20000] 47007665 ms: Scavenge 2027.3 (2079.3) -> 2021.7 (2080.3) MB, pooled: 0 MB, 4.65 / 0.01 ms
(average mu = 0.749, current mu = 0.771) allocation failure;
[1452221:0xf1964ae20000] 47007682 ms: Scavenge 2029.4 (2080.3) -> 2021.7 (2096.3) MB, pooled: 0 MB, 4.70 / 0.00 ms
(average mu = 0.749, current mu = 0.771) allocation failure;
<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
--- Native stack trace
1: 0xde5bfc node::00MErrorHandler(char const*, v8::00MDetails const&) [node]
2: 0x1169d6c v8::Utils::Report00MFailure(v8::internal::Isolate*, char const*, v8::00MDetails const&) [nodel
3: 0x1169f1c v8:: internal:: V8:: FatalProcessOut0fMemory(v8::internal::Isolate*, char const*, v8::00MDetails const&) [node]
4: 0x138e7cc [node]
5: 0x13a6740 v8: :internal: :Heap: :CollectGarbage (v8::internal:: AllocationSpace, v8::internal:: GarbageCollectionReas on, v8:: GCCallbackFlags) [nodel
6: 0x137d068 v8:: internal::HeapAllocator: :AllocateRawWithLightRetrySlowPath(int, v8: :internal:: AllocationType, v8:
: internal:: AllocationOrigin, v8: :internal:: AllocationAlignment) [node]
7: 0x137dea0 v8: :internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal:: AllocationType, v8 ::internal:: AllocationOrigin, v8: :internal:: AllocationAlignment) [node]
8: 0x13587c0 v8:: internal:: Factory:: AllocateRaw(int, v8::internal:: AllocationType, v8::internal:: AllocationAlignme nt) [node]
9: 0x1346bb8 v8: :internal:: FactoryBase<v8:: internal:: Factory>::AllocateRawWithImmortalMap(int, v8::internal::Alloc ationType, v8: :internal:: Tagged<v8: :internal:: Map>, v8:: internal:: AllocationAlignment) [nodel
10: 0x13480cc v8:: internal:: FactoryBase<v8:: internal:: Factory>::NewRawOneByteString(int, v8::internal:: AllocationTy pe) [nodel
11: 0x1363638 v8: :internal:: Factory::NewStringFromUtf8(v8::base: :Vector<char const>, v8: :internal:: AllocationType) [node]
12: 0x1185e4C V8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int) [node]
13: 0xf407a8 [node]
14: 0x1bee0f4 [node]
Aborted (core
Musing... (340s • T 3.0k tokens • esc to interrupt)
? for shortcuts
Bypassing Permissions
<--- Last few GCs --->
[1161188:0xf166ff4c0000] 42824177 ms: Mark-Compact 2042.9 (2086.8) -> 2042.1 (2086.8) MB, pooled: 0 MB, 1231.41 / 0
.00 ms (average mu = 0.418, current mu = 0.004) allocation failure; scavenge might not succeed
[1161188:0xf166ff4c0000] 42825532 ms: Mark-Compact 2044.1 (2086.8) -> 2043.9 (2094.5) MB, pooled: 0 MB, 1353.90 / 0
.00 ms
(average mu = 0.262, current mu = 0.000) allocation failure; scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
Native stack trace
1: Oxde5bfc node::00MErrorHandler(char const*, v8::00MDetails const&) [nodel
2: 0x1169d6c v8::Utils: :Report00MFailure(v8: :internal::Isolate*, char const*, v8::00MDetails const&) [node]
3: 0x1169f1c v8:: internal::V8:: FatalProcessOut0fMemory(v8: :internal::Isolate*, char const*, v8::00MDetails const&)
[node ]
4: 0x138e7cc [node]
5: 0x13a6740 v8::internal:: Heap:: CollectGarbage (v8: :internal:: AllocationSpace, v8: :internal:: GarbageCollectionReas on, v8:: GCCallbackFlags) [nodel
6: 0x137d068 v8:: internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal:: AllocationType, v8:
: internal:: AllocationOrigin, v8: :internal::AllocationAlignment) [node]
7: 0x137dea0 v8: :internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8: :internal:: AllocationType, v8 ::internal:: AllocationOrigin, v8:: internal:: AllocationAlignment) [node]
8: 0x1358c0 v8: :internal:: Factory: NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::Allocati onType, v8:: internal:: AllocationOrigin) [nodel
9: 0x177296c v8: :internal:: Runtime_AllocateInYoungGeneration(int, unsigned long*, v8: :internal:: Isolate*) [nodel
10: 0x1c819d4 [node]
Aborted (core dumped)
Striving... (193s • 1 1.7k tokens • esc to interrupt)
? for shortcuts
Bypassing Permissions
Context left until auto-compact: 12%
<--- Last few GCs --->
[1295239:0xebab1d8900001 21565009 ms: Scavenge 1972.0 (2053.9) -> 1962.6 (2053.9) MB, pooled: 0 MB, 5.59 / 0.01 ms
(average mu = 0.373, current mu = 0.363) allocation failure;
[1295239:0xebab1d890000] 21566232 ms: Mark-Compact 1983.7 (2067.2) -> 1936.6 (2028.1) MB, pooled: 26 MB, 1171.94 /
0.01 ms
(average mu = 0.335, current mu = 0.296) task; 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: 0xde5bfc node::00MErrorHandler(char const*, v8::00MDetails const&) [nodel
2: 0x1169d6c v8:: Utils: :Report00MFailure(v8::internal::Isolate*, char const*, v8::00MDetails const&) [node]
3: 0x1169f1c v8:: internal:: V8:: FatalProcessOut0fMemory(v8::internal::Isolate*, char const*, v8::00MDetails const&)
[nodel
4: 0x138e7cc [node]
5: 0x138e7fc
[node]
6: 0x13a61e0 [node]
7: 0x13a8dcc
[node ]
8: 0x1b8d9a4 [node]
Aborted (core dumped)
Debugging... (197s • 1 1.2k tokens • esc to interrupt)
› L
? for shortcuts
Bypassing Permissions
<--- Last few GCs --->
1898043:0xee87c08c0000 45950489 mS: Mark-Compact 2038.3 (2086.6) - 2036.3 (2086.6) MB, pooled: 0 MB, 1377.71 / 0.
00 ms (average mu = 0.155, current mu = 0.006) allocation failure; scavenge might not succeed
[898043:0xee87c08c0000] 45951883 ms: Mark-Compact 2038.4 (2086.6) -> 2036.5 (2086.6) MB, pooled: 0 MB, 1392.06 / 0.
00 ms
(average mu = 0.082, current mu = 0.001) 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: 0xde5bfc node::00MErrorHandler(char const*, v8::00MDetails const&) [node]
2: 0x1169d6c v8:: Utils:: Report00MFailure(v8: :internal::Isolate*, char const*,
v8: :00MDetails const&) [node]
3: 0x1169f1c v8:: internal:: V8:: FatalProcessOut0fMemory(v8:: internal:: Isolate*,
char const*, v8::00MDetails const&)
[node]
4: 0x138e7cc
[node ]
5: 0x138e7fc
[node]
6: 0x13a61e0 [node]
7: 0x13a8dcc [node]
8: 0x1b8d9a4 [node]
Aborted (core dumped)
Achieving... (888s • T 11.9k tokens • esc to interrupt)
? for shortcuts
Bypassing Permissions
<--- Last few GCs --->
[988433:0xe431e34f0000] 31846577 ms: Scavenge (interleaved) 2038.7 (2084.3) -> 2038.6 (2095.1) MB, pooled: 0 MB, 9.
32 / 0.00 ms
(average mu = 0.698, current mu = 0.170) allocation failure;
[988433:0xe431e34f0000] 31848429 ms: Mark-Compact (reduce) 2045.4 (2095.1) -> 2045.2 (2087.8) MB, pooled: 0 MB, 169
6.94 / 0.00 ms
(+ 43.8 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking
1754 ms) (average mu = 0.
‹--- JS stacktrace -->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
--- Native stack trace --
1: 0xde5bfc node: :00MErrorHandler(char const*, v8::00MDetails const&) [node]
2: 0x1169d6c v8::Utils::Report00MFailure(v8::internal:: Isolate*, char const*, v8::00MDetails const&) [node]
3: 0x1169f1c v8: :internal::V8:: FatalProcessOut0fMemory (v8: :internal::Isolate*, char const*, v8::00MDetails const&) [node]
4: 0x138e7cc [node]
5: 0x13a6740 v8: :internal:: Heap:: CollectGarbage (v8::internal:: AllocationSpace, v8: :internal:: GarbageCollectionReas on, v8:: GCCallbackFlags) [nodel
6: 0x137d068 v8:: internal: :HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8:
: internal:: AllocationOrigin, v8::internal:: AllocationAlignment) [node]
7: 0x137dea0 v8: :internal: :HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8 ::internal:: AllocationOrigin, v8: :internal::AllocationAlignment) [node]
8: 0x1358c0 v8: :internal:: Factory: NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::Allocati onType, v8:: internal:: AllocationOrigin) [nodel
9: 0x177296c v8:: internal:: Runtime_AllocateInYoungGeneration(int, unsigned long*, v8: :internal:: Isolate*) [node]
10: 0x1c819d4 [node]
Aborted (core dumped)
<--- Last few GCs --->
1781133:0xfbe3346200001 21208030 ms: Scavenge (interleaved) 2030.8 (2080.8) - 2030.1 (2082.1) MB, pooled: 0 MB, 10
•97 / 0.00 ms (average
mu = 0.810, current mu = 0.160) allocation failure;
[781133:0xfbe334620000] 21208138 ms: Scavenge (interleaved) 2031.9 (2082.1) -> 2030.8 (2104.1) MB, pooled: 0 MB, 10
6.15 / 0.00 ms (average mu = 0.810, current mu = 0.160) allocation failure;
<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
-_—_- Native stack trace ---
1: Oxde5bfc node::00MErrorHandler(char const*, v8::00MDetails const&) [node]
2: 0x1169d6c v8::Utils::Report00MFailure(v8: :internal:: Isolate*, char const*,
v8:: 00MDetails const&) [nodel
3: 0x1169f1c v8:: internal:: V8:: FatalProcessOut0fMemory(v8::internal::Isolate*, char const*, v8::00MDetails const&)
[node ]
4: 0x138e7cc [node]
5: 0x13a6740 v8: :internal::Heap: :CollectGarbage(v8: :internal::AllocationSpace, v8::internal:: GarbageCollectionReas on, v8:: GCCallbackFlags) [nodel
6: 0x137d068 v8: :internal: :HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8:
:internal::AllocationOrigin, v8: :internal:: AllocationAlignment) [nodel
7: 0x137dea0 v8:: internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal:: AllocationType, v8 ::internal:: AllocationOrigin, v8: :internal:: AllocationAlignment) [node]
8: 0x1358c0 v8: :internal:: Factory::NewFillerObject(int, v8::internal:: AllocationAlignment, v8::internal: :Allocati onType, v8: :internal:: AllocationOrigin) [node]
9: 0x177296c v8: :internal: :Runtime_AllocateInYoungGeneration(int, unsigned long*, v8: :internal:: Isolate*) [node]
10: 0x1c819d4 [nodel
Aborted (core dumped)
<—-- Last few GCs --->
[456736:0xfe18152c0000] 51008632 ms: Mark-Compact 2042.0 (2086.1) -> 2040.0 (2086.1) MB, pooled: 0 MB, 1394.59 / 0.
00 ms
(average mu = 0.065, current mu = 0.001) allocation failure; scavenge might not
succeed
[456736:0xfe18152c0000] 51010045 ms: Mark-Compact 2042.1 (2086.4) -> 2040.2 (2086.4) MB, pooled: 0 MB, 1411.24 / 0.
00 ms
(average mu = 0.034, current mu = 0.001) 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: Oxde5bfc node::00MErrorHandler(char const*, v8::00MDetails const&) [node]
2: 0x1169d6c V8::Utils::Report00MFailure(v8::internal::Isolate*, char const*, v8::00MDetails const&) [node]
3: 0x1169f1c v8:: internal:: V8:: FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::00MDetails const&) [node]
4: 0x138e7cc [node]
5: 0x138e7fc [node]
6: 0x13a61e0
[node ]
7: 0x13a8dcc [node]
8: 0x1b8d9a4 [node]
Aborted (core dumped)
Polishing... (474s • T 3.4k tokens • esc to interrupt)
? for shortcuts
Bypassing Permissions
<—-- Last few GCs --->
[592347:0xe940cae90000] 30814645 ms: Mark-Compact (reduce) 2042.7 (2085.2) -> 2042.3 (2085.2) MB, pooled: 0 MB, 556 .91 / 0.00 ms (+ 772.9 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 1412 ms) (average mu = 0.[592347:0xe940cae90000] 30816182 ms: Mark-Compact 2043.3 (2085.2) -> 2043.1 (2089.0) MB, р
ooled: 0 MB, 1536.71 / 0.00 ms (average mu = 0.508, current mu = 0.000) allocation failure; scavenge might not suc
ceed
<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
_---- Native stack trace
1: 0xde5bfc node::00MErrorHandler(char const*, v8::00MDetails const&) [node]
2: 0x1169d6c v8:: Utils: :Report00MFailure (v8::internal:: Isolate*, char const*, v8::00MDetails const&) [node]
3: 0x1169f1c v8:: internal::V8: :FatalProcessOutOfMemory(v8:: internal::Isolate*, char const*, v8::00MDetails const&) [node ]
4: 0x138e7cc [node]
5: 0x13a6740 v8: :internal: :Heap: :CollectGarbage(v8: :internal:: AllocationSpace, v8: :internal:: GarbageCollectionReas on, v8: :GCCallbackFlags) [node]
6: 0x137d068 v8: :internal::HeapAllocator::A1locateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8: :internal:: AllocationOrigin, v8:: internal:: AllocationAlignment) [node]
7: 0x137dea0 v8: :internal: :HeapAllocator: :AllocateRawWithRetry0rFailSlowPath(int, v8::internal:: AllocationType, v8 ::internal: :AllocationOrigin, v8: :internal: :AllocationAlignment) [node]
8: 0x1358fc0 v8:: internal:: Factory::NewFiller0bject(int, v8: :internal: :AllocationAlignment, v8: :internal:: Allocati onType, v8: :internal:: AllocationOrigin) [node]
9: 0x177296c v8:: internal: :Runtime_AllocateInYoungGeneration(int, unsigned long*, v8: :internal:: Isolate*) [node]
10: 0x1c819d4 [node]
Aborted (core dumped)
Analyzing. (58s • * 325 tokens • esc to interrupt)
> I
? for shortcuts
Bypassing Permissions
Context left until auto-compact: 6%
<--- Last few GCs --->
[302432:0xe8f2c1eb0000] 24439521 ms: Scavenge (reduce) (interleaved) 1990.4 (2032.1) -> 1989.6 (2032.1) MB, pooled:
0 MB, 5.12 / 0.00 ms (average mu = 0.379, current mu = 0.368) allocation failure;
[302432:0xe8f2c1eb0000] 24439614 ms: Mark-Compact (reduce) 1990.4 (2032.1) -> 1935.3 (2017.8) MB, pooled: 0 MB, 21.
64 / 0.01 ms (+ 1248.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking
1447 ms) (average mu = 0.
<——— JS stacktrace ———>
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
-—_—— Native stack trace
1: Oxde5bfc node::00MErrorHandler(char const*, v8::00MDetails const&) [node]
2: 0x1169d6c v8::Utils::Report00MFailure(v8::internal::Isolate*, char const*,
v8: :00MDetails const&) [node]
3: 0x1169f1c v8:: internal::V8:: FatalProcessOut0fMemory(v8::internal::Isolate*, char const*, v8::00MDetails const&)
[node ]
4: 0x138e7cc
[node ]
5: 0x138e7fc
[node ]
6: 0x13a61e0 [node]
7: 0x13a8dcc [node]
8: 0x1b8d9a4 [node]
Aborted (core dumped)
Catching... (1240s • * 12.7k tokens • esc to interrupt)
? for shortcuts
Bypassing Permissions
Context left until auto-compact: 4%
<--- Last few GCs --->
[73443:0xfb20a8880000] 15332031 ms: Scavenge (reduce) (interleaved) 1989.6 (2032.4) -> 1989.4 (2032.9) MB, pooled: 0 MB, 5.68 / 0.00 ms
(average mu = 0.364, current mu = 0.372) allocation failure;
[73443:0xfb20a8880000] 15332093 ms: Mark-Compact (reduce) 1989.9 (2032.9) -> 1937.1 (2017.7) MB, pooled: 0 MB, 22.92 / 0.01 ms (+ 1331
•5 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 1574 ms) (average mu = 0.3
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace
1: Oxde5bfc node::00MErrorHandler(char const*, v8::00MDetails const&) [node]
2: 0x1169d6c v8::Utils::Report00MFailure(v8: :internal::Isolate*, char const*,
v8:: 00MDetails const&) [node]
3: 0x1169f1c v8: :internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::00MDetails const&) [node]
4: 0x138e7cc [node]
5: 0x138e7fc
[node]
6: 0x13a61e0 [node]
7: 0x13a8dcc [node]
8: 0x1b8d9a4 [node]
Aborted (core dumped)

Environment Info

  • Platform: macos
  • Terminal: Apple_Terminal
  • Version: 1.0.5
  • Feedback ID: 44e12588-9f33-4ad7-bc4d-e653872aa698

Errors

[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n    at genericNodeError (node:internal/errors:983:15)\n    at wrappedFn (node:internal/errors:537:14)\n    at checkExecSyncError (node:child_process:882:11)\n    at execSync (node:child_process:954:15)\n    at eG (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:644:3921)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:572:6540\n    at Q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:532:16886)\n    at aR1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:572:5789)\n    at DG (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:572:5406)\n    at TU2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1976:21058)","timestamp":"2025-05-29T22:40:06.662Z"},{"error":"Error: ENOENT: no such file or directory, scandir '/Users/rozzie/.claude/ide'\n    at Module.readdirSync (node:fs:1581:26)\n    at Object.readdirSync (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:542:1562)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1348:16549\n    at Array.flatMap (<anonymous>)\n    at Ev0 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1348:16519)\n    at xs (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1349:3280)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2391:11385\n    at p7 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:150:21374)\n    at cZ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:150:40861)\n    at $W (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:150:34915)","timestamp":"2025-05-29T22:40:06.692Z"},{"error":"Error: ENOENT: no such file or directory, scandir '/Users/rozzie/.claude/ide'\n    at Module.readdirSync (node:fs:1581:26)\n    at Object.readdirSync (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:542:1562)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1348:16549\n    at Array.flatMap (<anonymous>)\n    at Ev0 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1348:16519)\n    at eB6 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1349:1224)\n    at Hv0 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1349:3005)\n    at Ov0 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1349:6648)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2459:2113\n    at p7 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:150:21374)","timestamp":"2025-05-29T22:40:06.693Z"},{"error":"Error: ENOENT: no such file or directory, scandir '/Users/rozzie/.claude/ide'\n    at Module.readdirSync (node:fs:1581:26)\n    at Object.readdirSync (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:542:1562)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1348:16549\n    at Array.flatMap (<anonymous>)\n    at Ev0 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1348:16519)\n    at xs (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1349:3280)\n    at Hv0 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1349:3072)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-05-29T22:40:06.699Z"},{"error":"Error: Command failed: /opt/homebrew/Cellar/ripgrep/14.1.1/bin/rg --files --hidden /Users/rozzie/tmp\nrg: /Users/rozzie/tmp/x2/pca10056/blank: Permission denied (os error 13)\n\n    at genericNodeError (node:internal/errors:983:15)\n    at wrappedFn (node:internal/errors:537:14)\n    at ChildProcess.exithandler (node:child_process:414:12)\n    at ChildProcess.emit (node:events:507:28)\n    at ChildProcess.emit (node:domain:489:12)\n    at maybeClose (node:internal/child_process:1101:16)\n    at Socket.<anonymous> (node:internal/child_process:457:11)\n    at Socket.emit (node:events:507:28)\n    at Socket.emit (node:domain:489:12)\n    at Pipe.<anonymous> (node:net:351:12)","timestamp":"2025-05-29T22:40:06.758Z"},{"error":"AxiosError: Request failed with status code 401\n  

Note: Error logs were truncated.

rayozzie avatar May 29 '25 22:05 rayozzie

You may wish to close this one, and just write it up in the doc that "if you see JavaScript Heap Out of Memory, get more memory". I just shifted my workload from a 24GB Macbook and a 16GB Ubuntu instance to a 128GB Ubuntu instance, and I haven't seen the heap out of memory for the full day.

rayozzie avatar May 31 '25 03:05 rayozzie

Temporary solution:

node --max-old-space-size=8192 $(which claude)

ulshv avatar Jun 04 '25 11:06 ulshv

Temporary solution:

node --max-old-space-size=8192 $(which claude)

Nah, they have a memory leak or an infinite loop - the corresponding node process just fills up the whole heap (be it 8GB or more) and then crashes with the specified error OP posted

ulshv avatar Jun 04 '25 11:06 ulshv

Temporary fix:

npm i -g @anthropic-ai/[email protected]
claude config set -g autoUpdaterStatus disabled

ulshv avatar Jun 04 '25 11:06 ulshv

I was also seeing this behavior in 1.0.10, and downgraded to 1.0.9 as @ulshv suggested -- does seem like a memory bug in 1.0.10

sajennings79 avatar Jun 04 '25 17:06 sajennings79

Same issue, keep crashing

<--- Last few GCs --->

[380286:0x556c2b398250] 1294935 ms: Mark-sweep 1877.5 (2084.6) -> 1861.9 (2084.6) MB, 82.8 / 0.0 ms (average mu = 0.288, current mu = 0.233) allocation failure; scavenge might not succeed [380286:0x556c2b398250] 1295062 ms: Mark-sweep 1878.3 (2084.8) -> 1861.8 (2085.1) MB, 89.3 / 0.0 ms (average mu = 0.292, current mu = 0.296) allocation failure; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 0x556c27998954 node::Abort() [node] 2: 0x556c2782b666 node::OOMErrorHandler(char const*, bool) [node] 3: 0x556c27b9ffa4 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node] 4: 0x556c27ba0266 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node] 5: 0x556c27d65299 [node] 6: 0x556c27d6c64a [node] 7: 0x556c27d7c702 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*, v8::GCCallbackFlags) [node] 8: 0x556c27d7cf89 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node] 9: 0x556c27d58049 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node] 10: 0x556c27d59258 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node] 11: 0x556c27d3ce74 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node] 12: 0x556c27d36628 v8::internal::FactoryBasev8::internal::Factory::AllocateRawWithImmortalMap(int, v8::internal::AllocationType, v8::internal::Map, v8::internal::AllocationAlignment) [node] 13: 0x556c27d3b429 v8::internal::MaybeHandlev8::internal::SeqTwoByteString v8::internal::FactoryBasev8::internal::Factory::NewRawStringWithMapv8::internal::SeqTwoByteString(int, v8::internal::Map, v8::internal::AllocationType) [node] 14: 0x556c2811f815 v8::internal::IncrementalStringBuilder::Extend() [node] 15: 0x556c27e86c48 v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_(v8::internal::Handlev8::internal::Object, bool, v8::internal::Handlev8::internal::Object) [node] 16: 0x556c27e89e2e v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_(v8::internal::Handlev8::internal::Object, bool, v8::internal::Handlev8::internal::Object) [node] 17: 0x556c27e898d2 v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_(v8::internal::Handlev8::internal::Object, bool, v8::internal::Handlev8::internal::Object) [node] 18: 0x556c27e8a7d2 v8::internal::JsonStringifier::Stringify(v8::internal::Handlev8::internal::Object, v8::internal::Handlev8::internal::Object, v8::internal::Handlev8::internal::Object) [node] 19: 0x556c27e8a8c5 v8::internal::JsonStringify(v8::internal::Isolate*, v8::internal::Handlev8::internal::Object, v8::internal::Handlev8::internal::Object, v8::internal::Handlev8::internal::Object) [node] 20: 0x556c27c24635 v8::internal::Builtin_JsonStringify(int, unsigned long*, v8::internal::Isolate*) [node] 21: 0x556c284eba79 [node] Aborted (core dumped)

khoaofgod avatar Jun 04 '25 19:06 khoaofgod

Same issue. Claude Code Status v1.0.11.

<--- Last few GCs --->

[51113:0x148008000] 1889744 ms: Scavenge 3874.1 (4138.7) -> 3870.7 (4138.7) MB, pooled: 0 MB, 2.54 / 0.00 ms (average mu = 0.828, current mu = 0.000) allocation failure; [51113:0x148008000] 1889751 ms: Scavenge 3874.2 (4138.7) -> 3870.8 (4146.9) MB, pooled: 0 MB, 5.50 / 0.00 ms (average mu = 0.828, current mu = 0.000) allocation failure;

<--- JS stacktrace --->

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

1: 0x100d131e4 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 2: 0x100f12fd8 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 3: 0x101120f30 v8::internal::Heap::stack() [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 4: 0x10111f2d0 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 5: 0x1011138b8 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 6: 0x1011140f0 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 7: 0x1010f7410 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 8: 0x101512ae4 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 9: 0x1019d5af4 Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 10: 0x107bf6750 11: 0x107dcbe94 12: 0x107929b70 13: 0x107f558e8 14: 0x107bf33ec 15: 0x107d68cf0 16: 0x107b31c68 17: 0x107aa4864 18: 0x107d6dffc 19: 0x107b2ff08 20: 0x10197d290 Builtins_AsyncFunctionAwaitResolveClosure [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 21: 0x101a484d8 Builtins_PromiseFulfillReactionJob [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 22: 0x10196d594 Builtins_RunMicrotasks [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 23: 0x10193eaf4 Builtins_JSRunMicrotasksEntry [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 24: 0x101078e6c v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 25: 0x101079714 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 26: 0x10107984c v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 27: 0x1010a6ac8 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 28: 0x1010a724c v8::internal::MicrotaskQueue::PerformCheckpoint(v8::Isolate*) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 29: 0x101942f98 Builtins_CallApiCallbackGeneric [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 30: 0x107794a14 31: 0x10193ec0c Builtins_JSEntryTrampoline [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 32: 0x10193e8f4 Builtins_JSEntry [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 33: 0x101078eac v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 34: 0x101078808 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handlev8::internal::Object, v8::internal::Handlev8::internal::Object, int, v8::internal::Handlev8::internal::Object) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 35: 0x100f29544 v8::Function::Call(v8::Localv8::Context, v8::Localv8::Value, int, v8::Localv8::Value) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 36: 0x100c1da80 node::InternalCallbackScope::Close() [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 37: 0x100c1dcc4 node::InternalMakeCallback(node::Environment*, v8::Localv8::Object, v8::Localv8::Object, v8::Localv8::Function, int, v8::Localv8::Value, node::async_context, v8::Localv8::Value) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 38: 0x100c32fd4 node::AsyncWrap::MakeCallback(v8::Localv8::Function, int, v8::Localv8::Value) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 39: 0x100e25910 node::StreamBase::CallJSOnreadMethod(long, v8::Localv8::ArrayBuffer, unsigned long, node::StreamBase::StreamBaseJSChecks) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 40: 0x100e270a4 node::EmitToJSStreamListener::OnStreamRead(long, uv_buf_t const&) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 41: 0x100ea660c node::crypto::TLSWrap::ClearOut() [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 42: 0x100ea8574 node::crypto::TLSWrap::OnStreamRead(long, uv_buf_t const&) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 43: 0x100e2b56c node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 44: 0x100e2bcb4 node::LibuvStreamWrap::ReadStart()::$_1::__invoke(uv_stream_s*, long, uv_buf_t const*) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 45: 0x1019276d8 uv__stream_io [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 46: 0x10192f920 uv__io_poll [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 47: 0x10191c674 uv_run [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 48: 0x100c1e508 node::SpinEventLoopInternal(node::Environment*) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 49: 0x100d5c154 node::NodeMainInstance::Run() [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 50: 0x100cd2364 node::Start(int, char**) [/Users/yoav/.nvm/versions/node/v22.14.0/bin/node] 51: 0x18c1cab98 start [/usr/lib/dyld] zsh: abort /Users/yoav/.claude/local/claude --dangerously-skip-permissions

yhak76 avatar Jun 04 '25 20:06 yhak76

1.0.9 version crashes for me as well without any messages,

❯claude --version
1.0.9 (Claude Code)

Anyone know where the logs are as I don't get any messaging just shuts down.

nickolay-kondratyev avatar Jun 04 '25 21:06 nickolay-kondratyev

happened to me since today. v1.0.11

C4T4 avatar Jun 04 '25 21:06 C4T4

i just had this as well:

<--- Last few GCs --->

[169432:0x563e2f265cf0] 57652611 ms: Mark-sweep 4012.3 (4140.0) -> 4002.2 (4142.1) MB, 343.5 / 0.0 ms (average mu = 0.866, current mu = 0.094) allocation failure; scavenge might not succeed [169432:0x563e2f265cf0] 57653240 ms: Mark-sweep 4020.6 (4142.1) -> 4010.6 (4144.1) MB, 599.6 / 0.0 ms (average mu = 0.692, current mu = 0.047) allocation failure; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory 1: 0x7fbe0d80333c node::Abort() [/lib/x86_64-linux-gnu/libnode.so.109] 2: 0x7fbe0d6f75db [/lib/x86_64-linux-gnu/libnode.so.109] 3: 0x7fbe0dbe9544 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/lib/x86_64-linux-gnu/libnode.so.109] 4: 0x7fbe0dbe9938 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/lib/x86_64-linux-gnu/libnode.so.109] 5: 0x7fbe0ddd50e9 [/lib/x86_64-linux-gnu/libnode.so.109] 6: 0x7fbe0ddeac69 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/lib/x86_64-linux-gnu/libnode.so.109] 7: 0x7fbe0ddc5c5a v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/lib/x86_64-linux-gnu/libnode.so.109] 8: 0x7fbe0ddc6d78 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/lib/x86_64-linux-gnu/libnode.so.109] 9: 0x7fbe0dda6f01 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/lib/x86_64-linux-gnu/libnode.so.109] 10: 0x7fbe0e19e860 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/lib/x86_64-linux-gnu/libnode.so.109] 11: 0x7fbe0daf91f9 [/lib/x86_64-linux-gnu/libnode.so.109] Aborted (core dumped)

Update:

Just got a similar error again:

<--- Last few GCs --->

[497805:0x559ba67cf9c0] 2244524 ms: Mark-sweep 3804.1 (4129.2) -> 3787.8 (4129.2) MB, 103.8 / 0.0 ms (average mu = 0.226, current mu = 0.161) allocation failure; scavenge might not succeed [497805:0x559ba67cf9c0] 2244651 ms: Mark-sweep 3804.5 (4129.5) -> 3787.9 (4129.5) MB, 99.5 / 0.0 ms (average mu = 0.222, current mu = 0.217) allocation failure; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 0x7f738df0133c node::Abort() [/lib/x86_64-linux-gnu/libnode.so.109] 2: 0x7f738ddf55db [/lib/x86_64-linux-gnu/libnode.so.109] 3: 0x7f738e2e7544 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/lib/x86_64-linux-gnu/libnode.so.109] 4: 0x7f738e2e7938 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/lib/x86_64-linux-gnu/libnode.so.109] 5: 0x7f738e4d30e9 [/lib/x86_64-linux-gnu/libnode.so.109] 6: 0x7f738e4d31cb [/lib/x86_64-linux-gnu/libnode.so.109] 7: 0x7f738e4e7d42 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*, v8::GCCallbackFlags) [/lib/x86_64-linux-gnu/libnode.so.109] 8: 0x7f738e4e88f6 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/lib/x86_64-linux-gnu/libnode.so.109] 9: 0x7f738e4c3c5a v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/lib/x86_64-linux-gnu/libnode.so.109] 10: 0x7f738e4c4d78 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/lib/x86_64-linux-gnu/libnode.so.109] 11: 0x7f738e4a4f01 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/lib/x86_64-linux-gnu/libnode.so.109] 12: 0x7f738e89c860 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/lib/x86_64-linux-gnu/libnode.so.109] 13: 0x7f738e1f71f9 [/lib/x86_64-linux-gnu/libnode.so.109] Aborted (core dumped)

1.0.11 (Claude Code)

grytrn avatar Jun 05 '25 07:06 grytrn

I'm having the same problem on version 1.0.11. At the moment it's not usable.

francescomugnai avatar Jun 05 '25 11:06 francescomugnai

Same issue for me when working on a larger project. Version 1.0.11.

<--- Last few GCs --->                                                                                                                                            
                                                                                                                                                                  
[1366774:0x2dbf0000] 31936019 ms: Scavenge (interleaved) 4088.8 (4096.4) -> 4088.7 (4101.4) MB, pooled: 0 MB, 4.95 / 0.00 ms  (average mu = 0.945, current mu = 0.
695) allocation failure;                                                                                                                                          
[1366774:0x2dbf0000] 31936333 ms: Mark-Compact (reduce) 4091.8 (4101.4) -> 4091.0 (4097.4) MB, pooled: 0 MB, 106.92 / 0.00 ms  (+ 158.4 ms in 0 steps since start 
of marking, biggest step 0.0 ms, walltime since start of marking 273 ms) (average mu = 0.890,                                                                     
                                                                                                                                                                  
<--- JS stacktrace --->                                                                                                                                           
                                                                                                                                                                  
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory                                                                                 
----- Native stack trace -----                                                                                                                                    
                                                                                                                                                                  
 1: 0xe98a91 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [node]                                                                                     
 2: 0x12a46c0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]                                                      
 3: 0x12a4a5c v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]                                        
 4: 0x1507995  [node]                                                                                                                                             
 5: 0x151ada2 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]                
 6: 0x14f38c2 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::Allo
cationAlignment) [node]                                                                                                                                           
 7: 0x14f3bf8 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::All
ocationAlignment) [node]                                                                                                                                          
 8: 0x14cae80 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node] 
 9: 0x194ce8b v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]                                                 
10: 0x764ec7eaf276                                                                                                                                                
Aborted (core dumped)        

Claude's own analysis of the issue when I asked Claude Code to diagnose the crash

● Looking at this stack trace, I crashed due to a JavaScript heap out of memory error. The crash occurred during garbage collection when the heap reached its limit (around 4GB based on the memory values shown).

Why I crashed:

  1. Heap memory exhaustion: The Node.js process ran out of available heap memory (4088.8 MB was being used)
  2. Failed garbage collection: The scavenge and mark-compact operations couldn't free enough memory
  3. Allocation failure: A new memory allocation request couldn't be fulfilled

How to prevent it going forward:

  1. Increase Node.js heap size: NODE_OPTIONS="--max-old-space-size=8192" # Increase to 8GB
  2. Memory leak prevention: - Avoid keeping large objects in memory unnecessarily - Clear references to large data structures when done - Use streaming for large file operations - Implement proper cleanup in event listeners
  3. For this codebase specifically: - Large video files or batch operations might consume significant memory - Consider processing items in smaller batches - Stream video data instead of loading entire files into memory - Monitor memory usage during long-running operations
  4. Docker considerations:

In docker-compose.yml, add memory limits

services: your-service: mem_limit: 8g memswap_limit: 8g

The immediate fix would be to restart with increased heap size, but long-term you should identify which operations are consuming excessive memory and optimize them.

bengizmo avatar Jun 05 '25 13:06 bengizmo

I'm having the same problem...

xied-ctrl avatar Jun 06 '25 22:06 xied-ctrl

Same here, on v1.0.17

wjr avatar Jun 07 '25 20:06 wjr

Same problem on a linux laptop with 96gb ram. Oom kicked in and killed it.

wiltaylor avatar Jun 12 '25 22:06 wiltaylor

Temporary fix:

npm i -g @anthropic-ai/[email protected] claude config set -g autoUpdaterStatus disabled

Didn't work for me. I open claude code and just leave it. after 5-10 minutes it takes up 130Gb+ of virtual memory

marmarko avatar Jun 13 '25 00:06 marmarko

I'm experiencing this, too.

# claude --version
1.0.22 (Claude Code)
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.5 LTS
Release:        22.04
Codename:       jammy
# uname -a
Linux w2245 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
# free -g
               total        used        free      shared  buff/cache   available
Mem:             125          79          39           0           6          45
Swap:            127           0         127

Log:

* Creating… (2s · ↑ 1.2k tokens · esc to interrupt)

╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ >                                                                                                                                                                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
  ? for shortcuts                                                                                                                                                                                Context left until auto-compact: 6%



<--- Last few GCs --->

[1674290:0x3627d000]  6172189 ms: Mark-Compact (reduce) 4008.2 (4050.6) -> 3977.1 (4011.6) MB, pooled: 0 MB, 8.95 / 0.08 ms  (+ 0.1 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 1331 ms) (average mu = 0.999, cu[1674290:0x3627d000]  6173644 ms: Mark-Compact 4233.1 (4267.6) -> 4233.0 (4240.3) MB, pooled: 35 MB, 130.16 / 0.00 ms  (average mu = 0.995, current mu = 0.911) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

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

 1: 0xe13fde node::OOMErrorHandler(char const*, v8::OOMDetails const&) [claude]
 2: 0x11d5070 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [claude]
 3: 0x11d5347 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [claude]
 4: 0x1402c05  [claude]
 5: 0x141c499 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [claude]
 6: 0x13f0b48 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [claude]
 7: 0x13f1a75 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [claude]
 8: 0x13c9e6e v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [claude]
 9: 0x13b8f64 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawWithImmortalMap(int, v8::internal::AllocationType, v8::internal::Tagged<v8::internal::Map>, v8::internal::AllocationAlignment) [claude]
10: 0x13ba42e v8::internal::FactoryBase<v8::internal::Factory>::NewRawOneByteString(int, v8::internal::AllocationType) [claude]
11: 0x13d5809 v8::internal::Factory::NewStringFromUtf8(v8::base::Vector<char const>, v8::internal::AllocationType) [claude]
12: 0x11f158d v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int) [claude]
13: 0xf8aec0  [claude]
14: 0x7fe5d6dcf745
Aborted (core dumped)

bluet avatar Jun 13 '25 15:06 bluet

Is this a duplicate issue of https://github.com/anthropics/claude-code/issues/952 ?

bluet avatar Jun 13 '25 15:06 bluet

Same here, can't downgrade to 1.09:

※ Tip: Start with small features or bug fixes, tell Claude to propose a plan, and verify its suggested edits

It looks like your version of Claude Code (1.0.9) needs an update.
A newer version (1.0.24 or higher) is required to continue.

To update, please run:
    claude update

This will ensure you have access to the latest features and improvements.

I really wish I hadn't paid for the pro plan just to get an unusable tool

marcofilippozzi-fz avatar Jul 02 '25 10:07 marcofilippozzi-fz

happening repeatedly to me too today Current version: 1.0.51, plenty of memory available.

PeaStew avatar Jul 15 '25 00:07 PeaStew

  • Often happens with subagents.
  • Currently on Claude Code 1.0.55.
  • I haven't found a working workaround yet.
  • Pop!_OS (Cosmic), all terminals, Node.js 22.16.0 (fnm)
Error
<--- Last few GCs --->

[636605:0x286d2000] 19125354 ms: Mark-Compact 4006.4 (4134.7) -> 3995.9 (4139.7) MB, pooled: 0 MB, 1946.68 / 0.00 ms  (average mu = 0.214, current mu = 0.017) allocation failure; scavenge might not succeed
[636605:0x286d2000] 19128258 ms: Mark-Compact 4011.8 (4139.7) -> 4001.5 (4145.4) MB, pooled: 0 MB, 2874.55 / 0.00 ms  (average mu = 0.100, current mu = 0.010) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

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

 1: 0xe13fde node::OOMErrorHandler(char const*, v8::OOMDetails const&) [claude]
 2: 0x11d5070 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [claude]
 3: 0x11d5347 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [claude]
 4: 0x1402c05  [claude]
 5: 0x141c499 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [claude]
 6: 0x13f0b48 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [claude]
 7: 0x13f1a75 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [claude]
 8: 0x13ca74e v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [claude]
 9: 0x182bd6c v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [claude]
10: 0x76b4ab66c476
Aborted (core dumped)

MartinKavik avatar Jul 17 '25 22:07 MartinKavik

We're actively working on improving memory usage. Expect this to feel better in the coming weeks.

bcherny avatar Jul 27 '25 21:07 bcherny

I'm experiencing the identical crash pattern described in this issue. Here's my stack trace:

<--- Last few GCs --->

[48672:0x148008000] 857688 ms: Mark-Compact 3953.4 (4131.4) -> 3942.7 (4139.4) MB, pooled: 0 MB, 840.75 / 0.00 ms (average mu = 0.406, current mu = 0.227) allocation failure; scavenge might not succeed [48672:0x148008000] 859062 ms: Mark-Compact 3958.9 (4139.7) -> 3948.7 (4145.4) MB, pooled: 0 MB, 1360.08 / 0.00 ms (average mu = 0.214, current mu = 0.010) allocation failure; scavenge might not succeed

<--- JS stacktrace --->

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

1: 0x102881cac node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/usr/local/bin/node] 2: 0x102a57998 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/local/bin/node] 3: 0x102c670c0 v8::internal::Heap::stack() [/usr/local/bin/node] 4: 0x102c65460 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node] 5: 0x102c59a48 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node] 6: 0x102c5a280 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node] 7: 0x102c3d5a0 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node] 8: 0x103059050 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node] 9: 0x103519af4 Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node] 10: 0x1034de358 Builtins_CloneObjectIC_Slow [/usr/local/bin/node] [...truncated similar to other reports...]

Context:

  • Platform: macOS (Darwin 23.6.0)
  • Crash occurred during normal MCP tool usage in a multi-step development workflow
  • Same async operation/promise handling pattern as other reports
  • Confirms this is a recurring issue affecting multiple users

The crash happened while following PM2 development workflow, using Serena MCP for code analysis, similar to the hook-related crashes described in issue #4732.

patrickstump avatar Aug 01 '25 18:08 patrickstump

First time to see this issue claude --version 1.0.67 (Claude Code)

I already upgraded my Javascript head to 8Gb , and it is not working. for me to is logical to still crash, increasing th memory just delay the crash and doesn't fix the issue of memory leaks or bad memory management. I am surprised that they took that long to fix the issue. I can see people suffering from it since version 1.0.5.

it is not related to subagent, issue appears vent you are just running Claude code.

Aborted()

<--- Last few GCs --->

[9365:0x138008000] 1126562 ms: Mark-Compact 8041.2 (8289.6) -> 7983.0 (8295.6) MB, pooled: 0 MB, 1540.75 / 0.00 ms (average mu = 0.172, current mu = 0.082) allocation failure; scavenge might not succeed [9365:0x138008000] 1128220 ms: Mark-Compact 8047.0 (8295.6) -> 7988.8 (8301.3) MB, pooled: 0 MB, 1519.54 / 0.00 ms (average mu = 0.127, current mu = 0.083) allocation failure; scavenge might not succeed

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory ----- Native stack trace -----

1: 0x104cceb58 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 2: 0x104e08af4 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 3: 0x104e08aac v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 4: 0x104fe56b0 v8::internal::Heap::stack() [/opt/homebrew/Cellar/node/24.5.0/bin/node] 5: 0x104fe7df0 v8::internal::Heap::OldGenerationConsumedBytes() const [/opt/homebrew/Cellar/node/24.5.0/bin/node] 6: 0x104fe7c90 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector, v8::base::TimeTicks) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 7: 0x104ff561c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags)::$_1::operator()() const [/opt/homebrew/Cellar/node/24.5.0/bin/node] 8: 0x104ff52c0 void heap::base::Stack::SetMarkerAndCallbackImpl<v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags)::$_1>(heap::base::Stack*, void*, void const*) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 9: 0x10573d7b8 PushAllRegistersAndIterateStack [/opt/homebrew/Cellar/node/24.5.0/bin/node] 10: 0x104fe3c70 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 11: 0x104fdb878 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 12: 0x104fc322c v8::internal::Factory::AllocateRawWithAllocationSite(v8::internal::DirectHandlev8::internal::Map, v8::internal::AllocationType, v8::internal::DirectHandlev8::internal::AllocationSite) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 13: 0x104fc6768 v8::internal::Factory::NewJSObjectFromMap(v8::internal::DirectHandlev8::internal::Map, v8::internal::AllocationType, v8::internal::DirectHandlev8::internal::AllocationSite, v8::internal::NewJSObjectType) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 14: 0x104f5ea28 v8::internal::(anonymous namespace)::GetStackFrames(v8::internal::Isolate*, v8::internal::DirectHandlev8::internal::FixedArray) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 15: 0x104f5e53c v8::internal::ErrorUtils::FormatStackTrace(v8::internal::Isolate*, v8::internal::DirectHandlev8::internal::JSObject, v8::internal::DirectHandlev8::internal::Object) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 16: 0x104f60f18 v8::internal::ErrorUtils::GetFormattedStack(v8::internal::Isolate*, v8::internal::DirectHandlev8::internal::JSObject) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 17: 0x104e4ba9c v8::internal::Accessors::ErrorStackGetter(v8::FunctionCallbackInfov8::Value const&) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 18: 0x10576294c Builtins_CallApiCallbackOptimizedNoProfiling [/opt/homebrew/Cellar/node/24.5.0/bin/node] 19: 0x140a45ef0 20: 0x14059ddec 21: 0x105760bec Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/24.5.0/bin/node] 22: 0x1057616e0 Builtins_InterpreterEnterAtBytecode [/opt/homebrew/Cellar/node/24.5.0/bin/node] 23: 0x105761720 Builtins_InterpreterEnterAtNextBytecode [/opt/homebrew/Cellar/node/24.5.0/bin/node] 24: 0x1405f0650 25: 0x140a369fc 26: 0x1401b05c4 27: 0x140617b94 28: 0x140517bdc 29: 0x10579f648 Builtins_AsyncFunctionAwaitResolveClosure [/opt/homebrew/Cellar/node/24.5.0/bin/node] 30: 0x1058745f8 Builtins_PromiseFulfillReactionJob [/opt/homebrew/Cellar/node/24.5.0/bin/node] 31: 0x10578ea50 Builtins_RunMicrotasks [/opt/homebrew/Cellar/node/24.5.0/bin/node] 32: 0x10575e7b0 Builtins_JSRunMicrotasksEntry [/opt/homebrew/Cellar/node/24.5.0/bin/node] 33: 0x104f3d90c v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 34: 0x104f3dfb8 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 35: 0x104f3e0a8 v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 36: 0x104f62ca4 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 37: 0x104f62ac0 v8::internal::MicrotaskQueue::PerformCheckpointInternal(v8::Isolate*) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 38: 0x10576294c Builtins_CallApiCallbackOptimizedNoProfiling [/opt/homebrew/Cellar/node/24.5.0/bin/node] 39: 0x14062a918 40: 0x10575e8cc Builtins_JSEntryTrampoline [/opt/homebrew/Cellar/node/24.5.0/bin/node] 41: 0x10575e570 Builtins_JSEntry [/opt/homebrew/Cellar/node/24.5.0/bin/node] 42: 0x104f3d93c v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 43: 0x104f3d32c v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::DirectHandlev8::internal::Object, v8::internal::DirectHandlev8::internal::Object, v8::base::Vector<v8::internal::DirectHandlev8::internal::Object const>) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 44: 0x104e19fe0 v8::Function::Call(v8::Isolate*, v8::Localv8::Context, v8::Localv8::Value, int, v8::Localv8::Value) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 45: 0x104c1c970 node::InternalCallbackScope::Close() [/opt/homebrew/Cellar/node/24.5.0/bin/node] 46: 0x104c1cbb0 node::InternalMakeCallback(node::Environment, v8::Localv8::Object, v8::Localv8::Object, v8::Localv8::Function, int, v8::Localv8::Value, node::async_context, v8::Localv8::Value) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 47: 0x104c2ba5c node::AsyncWrap::MakeCallback(v8::Localv8::Function, int, v8::Localv8::Value) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 48: 0x104d8e35c node::StreamBase::CallJSOnreadMethod(long, v8::Localv8::ArrayBuffer, unsigned long, node::StreamBase::StreamBaseJSChecks) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 49: 0x104d8f90c node::EmitToJSStreamListener::OnStreamRead(long, uv_buf_t const&) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 50: 0x104dec9f8 node::crypto::TLSWrap::ClearOut() [/opt/homebrew/Cellar/node/24.5.0/bin/node] 51: 0x104debe90 node::crypto::TLSWrap::Cycle() [/opt/homebrew/Cellar/node/24.5.0/bin/node] 52: 0x104dee648 node::crypto::TLSWrap::OnStreamRead(long, uv_buf_t const&) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 53: 0x104d920d0 node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 54: 0x104d9258c node::LibuvStreamWrap::ReadStart()::$_1::__invoke(uv_stream_s*, long, uv_buf_t const*) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 55: 0x109e73af0 uv__stream_io [/opt/homebrew/Cellar/libuv/1.51.0/lib/libuv.1.dylib] 56: 0x109e7aca8 uv__io_poll [/opt/homebrew/Cellar/libuv/1.51.0/lib/libuv.1.dylib] 57: 0x109e6ab58 uv_run [/opt/homebrew/Cellar/libuv/1.51.0/lib/libuv.1.dylib] 58: 0x104c1d3ec node::SpinEventLoopInternal(node::Environment*) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 59: 0x104cfe0e8 node::NodeMainInstance::Run(node::ExitCode*, node::Environment*) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 60: 0x104cfde7c node::NodeMainInstance::Run() [/opt/homebrew/Cellar/node/24.5.0/bin/node] 61: 0x104ca4318 node::Start(int, char**) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 62: 0x19d7beb98 start [/usr/lib/dyld] zsh: abort claude

ahmedibrahim085 avatar Aug 03 '25 16:08 ahmedibrahim085

@bcherny non of the open issues you mentioned have some one assigned to it. that means will not be fixed soon. that is really sad :( such a great tool keep crashing and wasting every one time since version 1,0,5 because no one is assigned to it. delaying its fix will simply mean the more features you launch fro Claude code the more the gravity of the situation will be.

ahmedibrahim085 avatar Aug 03 '25 16:08 ahmedibrahim085

I'm experiencing severe input lag in the interactive REPL mode, and I suspect it might be related to the memory issues described here. The performance degradation gets worse over time, which aligns with potential memory leaks.

My symptoms:

  • Keystroke lag in interactive mode (characters appear in batches)
  • Delete key sometimes takes 30+ seconds to respond (similar to what's mentioned in #1497)
  • Performance degrades the longer I use Claude Code
  • Eventually leads to crashes (though not always with OOM errors)

Environment:

  • OS: macOS Tahoe 26
  • Terminal: Both Alacritty + tmux and VSCode integrated terminal
  • Claude CLI version: 1.0.68
  • Memory: 32G

Key observation: The input lag progressively worsens during long sessions, suggesting memory accumulation issues might be affecting the event loop performance. When the tool becomes very laggy, memory usage is often high.

Current workaround:

  • Restarting claude regularly
  • Using --print mode which doesn't exhibit these issues: echo "prompt" | claude --print

Could the JavaScript heap issues be causing the event loop to slow down, resulting in the severe input lag many of us are experiencing? The correlation between session duration and performance degradation seems too strong to be coincidental.

Has anyone profiled the memory usage patterns during interactive sessions to see if there's a correlation with input responsiveness?

K-NRS avatar Aug 05 '25 10:08 K-NRS

I am experiencing the same issue on MacOS Tahoe: Bypassing Permissions Aborted()

<--- Last few GCs --->

[70625:0xb2d80c000] 349904 ms: Mark-Compact 8163.7 (8217.7) -> 8149.2 (8217.7) MB, pooled: 4 MB, 1384.58 / 0.00 ms (average mu = 0.144, current mu = 0.034) allocation failure; scavenge might not succeed [70625:0xb2d80c000] 351851 ms: Mark-Compact 8165.2 (8217.7) -> 8150.6 (8219.2) MB, pooled: 2 MB, 1903.71 / 0.00 ms (average mu = 0.076, current mu = 0.022) allocation failure; scavenge might not succeed

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory ----- Native stack trace -----

1: 0x100c7eb58 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 2: 0x100db8af4 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 3: 0x100db8aac v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 4: 0x100f956b0 v8::internal::Heap::stack() [/opt/homebrew/Cellar/node/24.5.0/bin/node] 5: 0x100f97df0 v8::internal::Heap::OldGenerationConsumedBytes() const [/opt/homebrew/Cellar/node/24.5.0/bin/node] 6: 0x100f97c90 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector, v8::base::TimeTicks) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 7: 0x100fa561c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags)::$_1::operator()() const [/opt/homebrew/Cellar/node/24.5.0/bin/node] 8: 0x100fa52c0 void heap::base::Stack::SetMarkerAndCallbackImpl<v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags)::$_1>(heap::base::Stack*, void*, void const*) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 9: 0x1016ed7b8 PushAllRegistersAndIterateStack [/opt/homebrew/Cellar/node/24.5.0/bin/node] 10: 0x100f93c70 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 11: 0x100f8b878 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 12: 0x100f6135c v8::internal::FactoryBasev8::internal::Factory::NewStructInternal(v8::internal::ReadOnlyRoots, v8::internal::Taggedv8::internal::Map, int, v8::internal::AllocationType) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 13: 0x100f81500 v8::internal::Factory::NewCallSiteInfo(v8::internal::DirectHandle<v8::internal::Union<v8::internal::Smi, v8::internal::HeapNumber, v8::internal::BigInt, v8::internal::String, v8::internal::Symbol, v8::internal::Boolean, v8::internal::Null, v8::internal::Undefined, v8::internal::JSReceiver>>, v8::internal::DirectHandle<v8::internal::Union<v8::internal::Smi, v8::internal::JSFunction>>, v8::internal::DirectHandlev8::internal::HeapObject, int, int, v8::internal::DirectHandlev8::internal::FixedArray) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 14: 0x100f08088 v8::internal::(anonymous namespace)::CallSiteBuilder::AppendFrame(v8::internal::DirectHandle<v8::internal::Union<v8::internal::Smi, v8::internal::HeapNumber, v8::internal::BigInt, v8::internal::String, v8::internal::Symbol, v8::internal::Boolean, v8::internal::Null, v8::internal::Undefined, v8::internal::JSReceiver, v8::internal::Hole>>, v8::internal::DirectHandle<v8::internal::Union<v8::internal::Smi, v8::internal::JSFunction>>, v8::internal::DirectHandlev8::internal::HeapObject, int, int, v8::internal::DirectHandlev8::internal::FixedArray) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 15: 0x100efac20 v8::internal::(anonymous namespace)::CaptureSimpleStackTrace(v8::internal::Isolate*, int, v8::internal::FrameSkipMode, v8::internal::Handlev8::internal::Object) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 16: 0x100efa3b8 v8::internal::Isolate::CaptureAndSetErrorStack(v8::internal::DirectHandlev8::internal::JSObject, v8::internal::FrameSkipMode, v8::internal::Handlev8::internal::Object) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 17: 0x100f10940 v8::internal::ErrorUtils::Construct(v8::internal::Isolate*, v8::internal::DirectHandlev8::internal::JSFunction, v8::internal::DirectHandlev8::internal::Object, v8::internal::DirectHandlev8::internal::Object, v8::internal::DirectHandlev8::internal::Object, v8::internal::FrameSkipMode, v8::internal::DirectHandlev8::internal::Object, v8::internal::ErrorUtils::StackTraceCollection) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 18: 0x100e111d0 v8::internal::Builtin_ErrorConstructor(int, unsigned long*, v8::internal::Isolate*) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 19: 0x1017ade94 Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit [/opt/homebrew/Cellar/node/24.5.0/bin/node] 20: 0x1297d8508 21: 0x1297cda2c 22: 0x101710bec Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/24.5.0/bin/node] 23: 0x1017116e0 Builtins_InterpreterEnterAtBytecode [/opt/homebrew/Cellar/node/24.5.0/bin/node] 24: 0x12946a5f4 25: 0x12962b450 26: 0x1295be880 27: 0x1294b9764 28: 0x1294a2474 29: 0x12951e43c 30: 0x10174f648 Builtins_AsyncFunctionAwaitResolveClosure [/opt/homebrew/Cellar/node/24.5.0/bin/node] 31: 0x1018245f8 Builtins_PromiseFulfillReactionJob [/opt/homebrew/Cellar/node/24.5.0/bin/node] 32: 0x10173ea50 Builtins_RunMicrotasks [/opt/homebrew/Cellar/node/24.5.0/bin/node] 33: 0x10170e7b0 Builtins_JSRunMicrotasksEntry [/opt/homebrew/Cellar/node/24.5.0/bin/node] 34: 0x100eed90c v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 35: 0x100eedfb8 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 36: 0x100eee0a8 v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 37: 0x100f12ca4 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 38: 0x100f12ac0 v8::internal::MicrotaskQueue::PerformCheckpointInternal(v8::Isolate*) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 39: 0x10171294c Builtins_CallApiCallbackOptimizedNoProfiling [/opt/homebrew/Cellar/node/24.5.0/bin/node] 40: 0x1295b33dc 41: 0x10170e8cc Builtins_JSEntryTrampoline [/opt/homebrew/Cellar/node/24.5.0/bin/node] 42: 0x10170e570 Builtins_JSEntry [/opt/homebrew/Cellar/node/24.5.0/bin/node] 43: 0x100eed93c v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 44: 0x100eed32c v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::DirectHandlev8::internal::Object, v8::internal::DirectHandlev8::internal::Object, v8::base::Vector<v8::internal::DirectHandlev8::internal::Object const>) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 45: 0x100dc9fe0 v8::Function::Call(v8::Isolate*, v8::Localv8::Context, v8::Localv8::Value, int, v8::Localv8::Value) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 46: 0x100bcc970 node::InternalCallbackScope::Close() [/opt/homebrew/Cellar/node/24.5.0/bin/node] 47: 0x100bccbb0 node::InternalMakeCallback(node::Environment, v8::Localv8::Object, v8::Localv8::Object, v8::Localv8::Function, int, v8::Localv8::Value, node::async_context, v8::Localv8::Value) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 48: 0x100bdba5c node::AsyncWrap::MakeCallback(v8::Localv8::Function, int, v8::Localv8::Value) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 49: 0x100d3e35c node::StreamBase::CallJSOnreadMethod(long, v8::Localv8::ArrayBuffer, unsigned long, node::StreamBase::StreamBaseJSChecks) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 50: 0x100d3f90c node::EmitToJSStreamListener::OnStreamRead(long, uv_buf_t const&) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 51: 0x100d9c9f8 node::crypto::TLSWrap::ClearOut() [/opt/homebrew/Cellar/node/24.5.0/bin/node] 52: 0x100d9be90 node::crypto::TLSWrap::Cycle() [/opt/homebrew/Cellar/node/24.5.0/bin/node] 53: 0x100d9e648 node::crypto::TLSWrap::OnStreamRead(long, uv_buf_t const&) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 54: 0x100d420d0 node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 55: 0x100d4258c node::LibuvStreamWrap::ReadStart()::$_1::__invoke(uv_stream_s*, long, uv_buf_t const*) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 56: 0x105dafaf0 uv__stream_io [/opt/homebrew/Cellar/libuv/1.51.0/lib/libuv.1.dylib] 57: 0x105db6ca8 uv__io_poll [/opt/homebrew/Cellar/libuv/1.51.0/lib/libuv.1.dylib] 58: 0x105da6b58 uv_run [/opt/homebrew/Cellar/libuv/1.51.0/lib/libuv.1.dylib] 59: 0x100bcd3ec node::SpinEventLoopInternal(node::Environment*) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 60: 0x100cae0e8 node::NodeMainInstance::Run(node::ExitCode*, node::Environment*) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 61: 0x100cade7c node::NodeMainInstance::Run() [/opt/homebrew/Cellar/node/24.5.0/bin/node] 62: 0x100c54318 node::Start(int, char**) [/opt/homebrew/Cellar/node/24.5.0/bin/node] 63: 0x19ec85924 start [/usr/lib/dyld]

calrizien avatar Aug 06 '25 07:08 calrizien

Image

This is ridiculous - we should be able to downgrade when it is broken (as it currently is with the heap issue).

@bcherny please assign someone to this

Claude code is currently unusable for the task I have assigned it

voycey avatar Aug 11 '25 11:08 voycey

Just want to mention for the sh method of binary installation this type of error will still occur. It will just crash and say core dumped. As of 1.0.77

ww2283 avatar Aug 13 '25 03:08 ww2283

@rayozzie ok bud 👍

You may wish to close this one, and just write it up in the doc that "if you see JavaScript Heap Out of Memory, get more memory". I just shifted my workload from a 24GB Macbook and a 16GB Ubuntu instance to a 128GB Ubuntu instance, and I haven't seen the heap out of memory for the full day.

<--- Last few GCs --->

[148530:0x3baa3000]  1400329 ms: Scavenge (interleaved) 4032.9 (4074.4) -> 4026.4 (4111.6) MB, pooled: 0 MB, 21.54 / 0.00 ms  (average mu = 0.219, current mu = 0.149) allocation failure; 
[148530:0x3baa3000]  1401695 ms: Mark-Compact (reduce) 4031.4 (4111.6) -> 4029.3 (4055.6) MB, pooled: 0 MB, 866.43 / 0.00 ms  (+ 400.5 ms in 80 steps since start of marking, biggest step 26.9 ms, walltime since start of marking 1283 ms) (average mu = 0.20
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

vscode ➜ /workspace $ free -m
               total        used        free      shared  buff/cache   available
Mem:          126477       44093       10436         793       71947       80445
Swap:              0           0           0

brb, buying another 128GB.

Details on how it happened for me:

  • Running vscode devcontainer for a long time (days), repeatedly restarting claude and whatnot, but it clearly kept leaking and deteriorated in performance over time (input lag in claude even after restart, very noticable)
  • Eventually it just died like this, reproducible, even on a new/smaller context query
  • Recreating the container didn't help
  • NODE_OPTIONS=--max-old-space-size didn't help
  • Tried a couple of times with various values, no luck, 100% reproducible on the same query (invoke an agent to do a thing, including running npm test)
  • Ran it w/ --verbose -d to see what it crashes on, and it didn't crash 😁
vscode    13704 48.2  0.1 27231988 253520 pts/0 Sl+  19:09   2:59 claude

Definitely still eating well, though.

  • I haven't run into this before today. Now I consistently run into it with subagents, feels like primarily subagent running another subagent.

fx avatar Aug 17 '25 18:08 fx