[BUG] High mem usage in a new session: 8,619 ArrayBuffers (each 524,432 bytes = 512KB + 144 byte header), totaling ~4.3 GB, are held only by weak references from the GC root
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Include the diagnostics JSON — it has everything needed. Key details to highlight:
- Fresh session, 18s uptime
- 4.9 GB arrayBuffers before any tool calls
- CC version 2.1.73, Node v24.3.0
8,619 ArrayBuffers (each 524,432 bytes = 512KB + 144 byte header), totaling ~4.3 GB, are held only by weak references from the GC root.
This means:
- Nothing in the application code is holding strong references to them
- They're retained solely by weak refs from (root) — this is how V8 tracks ArrayBuffers for the GC
- They're marked as "attached" (not detached), meaning V8 considers them still alive
This is a V8/Node.js GC issue, not a Claude Code application-level leak. The buffers are orphaned (no strong JS references) but V8 hasn't collected them. With Node v18.20.8 (which
your system is running despite the diagnostics saying v24.3.0 — the script ran under v18), this could be a known issue with ArrayBuffer GC pressure.
The 224 MB Response object is likely the Anthropic API streaming response, and the 512KB chunks are the streaming read buffers — each fetch body chunk gets a 512KB ArrayBuffer. After
being consumed, they should be GC'd, but V8 is holding them via weak refs.
Summary: Claude Code's HTTP streaming allocates ~512KB per chunk. After reading, the chunks lose all strong references but V8 isn't collecting them promptly. This is a Node.js/V8 GC
bug — the weak references from (root) keep them alive. Upgrading Node or adding explicit ArrayBuffer detachment after consumption would fix it.
c63a6d1e-ae19-4712-b776-90684bd4b400-diagnostics.json
What Should Happen?
claude should use a reasonable amount of memory
Error Messages/Logs
Steps to Reproduce
I just started a new session in a new terminal tab and got a memory use warning
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.73
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗