Memory leak: arrayBuffers growing at ~21 GB/hour in Claude Code process
Resolved 💬 3 comments Opened Mar 14, 2026 by G9KBytes-Labs Closed Mar 17, 2026
Description
Observed a severe memory leak in the Claude Code CLI process (Node.js). The arrayBuffers and external memory categories are growing at approximately 21 GB/hour, causing the process to consume several GB of RAM during normal usage.
Diagnostics
Captured via /heapdump command after ~3 minutes of uptime:
{
"timestamp": "2026-03-14T03:49:58.892Z",
"uptimeSeconds": 179.793,
"memoryUsage": {
"heapUsed": 5918248002,
"heapTotal": 45421568,
"external": 5877751058,
"arrayBuffers": 5414287613,
"rss": 1101414400
},
"memoryGrowthRate": {
"bytesPerSecond": 6126000.75,
"mbPerHour": 21031.95
},
"v8HeapStats": {
"heapSizeLimit": 11871027200,
"mallocedMemory": 5918540802,
"peakMallocedMemory": 1187102720,
"detachedContexts": 0,
"nativeContexts": 1
},
"activeHandles": 0,
"activeRequests": 0
}
Key Observations
arrayBuffersat 5.4 GB after only ~3 minutes — primary suspectexternalmemory at 5.8 GB — C++ objects linked to JS (Buffers, native addons)heapUsedis only 45 MB — the JS heap itself is healthy; the leak is entirely in native/buffer memoryactiveHandles: 0andactiveRequests: 0— no pending I/O, yet memory is not released- Growth rate of 21 GB/hour would exhaust most systems within an hour of use
The pattern strongly suggests Buffer or ArrayBuffer objects are being allocated (likely for file reads, streamed tool results, or response handling) and not being released or GC'd.
Environment
- Claude Code version: 2.1.72
- Node.js version: v24.3.0
- Platform: macOS Darwin 25.3.0 (Apple Silicon)
- Trigger: Manual (
/heapdump), occurred during normal interactive session
Heap Snapshot
A full .heapsnapshot file was captured and is available for analysis. It is too large to attach directly but can be shared on request.
Steps to Reproduce
- Start a Claude Code session
- Use the CLI normally for a few minutes (tool calls, file reads, etc.)
- Run
/heapdump - Observe
arrayBuffersandexternalmemory in the diagnostics JSON
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗