High memory usage: 5.9GB external ArrayBuffers within 26 seconds of startup
Summary
Claude Code v2.1.73 (also reproduced on v2.1.74) exhibits high memory usage immediately after startup. A manual /heapdump taken 26 seconds into a fresh session shows ~6.5 GB heap used, with 5.9 GB in external ArrayBuffers.
Environment
- Platform: Windows 11 Home (win32) 10.0.26200
- Node: v24.3.0
- Claude Code: 2.1.73 (current session), 2.1.74 installed
- Shell: bash (Git Bash)
- Project: UE5 C++ project (~4.4 GB on disk, .gitignore excludes binaries/intermediate)
- Memory files: 225 MB of session transcripts (143 .jsonl files), 36 KB of memory .md files
Diagnostics (from /heapdump)
{
"uptimeSeconds": 26.29,
"memoryUsage": {
"heapUsed": 6495827413,
"heapTotal": 51532800,
"external": 6459777423,
"arrayBuffers": 5929917893,
"rss": 2012729344
},
"memoryGrowthRate": {
"bytesPerSecond": 76559969,
"mbPerHour": 262847
}
}
Heap Snapshot Analysis
The V8 heap itself is healthy (~62 MB across all object types):
- Code: 21.3 MB
- Objects: 19.6 MB
- Native: 9.7 MB
- Closures: 5.6 MB
- Strings: 3.6 MB
The problem is entirely in external/native memory (5.9 GB ArrayBuffers) which V8's heap snapshot does not break down further.
Identified allocations (small, expected)
- 16 MB ArrayBuffer →
WebAssembly.Memory(tree-sitter WASM) - ~10 MB across 6 Blob objects (tree-sitter language grammars)
- Two WASM modules: tree-sitter + yoga-layout (
yoga-wasm-base64-esm.js)
Unaccounted
- ~5.87 GB of external ArrayBuffers with no V8-visible owner
- Growth rate of 73 MB/sec suggests continuous allocation without release
Reproduction
- Open Claude Code in a project with ~100+ prior session transcripts
- Run
/heapdumpimmediately after startup - Observe external memory far exceeding V8 heap
Hypothesis
The external ArrayBuffer growth pattern (73 MB/sec, linear) suggests streaming buffers (possibly API response chunks or file read buffers) are being allocated but not freed. The native memory is invisible to V8 GC, pointing to a leak in:
- Streaming API response handling (fetch/undici body buffers)
- File read operations during startup (context loading, CLAUDE.md, rules, memory)
- Session transcript processing (143 .jsonl files totaling 225 MB)
Attached
Heap snapshot and diagnostics JSON were saved locally. Happy to provide if needed.
🤖 Generated with Claude Code
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗