[BUG] Huge memory leak, fresh session rapidly climbs in RAM until I kill the session or it OOM's and crashes my system.
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?
Claude Code is leaking memory immediately after startup on Linux, even in a brand new session with no accumulated chat history. This is not chat context growth. It starts right away in a fresh chat and keeps climbing until the process is killed. In my case it got to about 10.5 GB RSS before I stopped it (this was the second time when i was diagnosing it, first time when I wasn't aware of it it did crash the system).
Environment:
- Claude Code 2.1.71
- Linux
- Node v24.3.0
What I saw from /heapdump:
- Dump taken at about 55.8s uptime
- RSS: 2010611712
- External memory: 1937232481
- ArrayBuffers: 1616106971
- Growth rate: 36020864 bytes/sec (~36 MB/s)
- activeHandles: 0
- activeRequests: 0
Heap snapshot highlights:
- 6099 ArrayBuffer objects totaling about 1539 MB
- 6090 of those are exactly 262288 bytes each
- One live native:Response around 223.16 MB
The important part is that the large retained Response is for downloading the 2.1.72 Linux Claude Code
binary, while the running version is 2.1.71. I noticed similar behavior when running "claude update", it was stuck it "searching for newer versions" while the RAM usage kept climbing.
The retained path in the heap goes through:
- IncomingMessage.FetchAPI
- ClientRequest.res
- Writable._currentRequest
The heap also contains updater/native-installer related strings, and the request appears to be using Axios with responseType: "arraybuffer".
Looks like a startup auto-update/native-installer leak, not normal session growth. It seems like the updater is downloading the new binary into memory and retaining the response/chunk buffers instead of releasing them.
I have attached the diagnostic json file generated from heapdump for reference.
What Should Happen?
Claude Code should start a fresh session and auto (or manual) update without rapidly increasing memory usage. Startup update checks/downloads should not retain large binary buffers in memory, and RSS should remain stable instead of continuously climbing until the process is killed.
Error Messages/Logs
Steps to Reproduce
Rough Reproduction:
- Launch Claude Code 2.1.71 on Linux
- Start a fresh session
- Watch RAM climb immediately
- Run /heapdump
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.71
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗