[BUG] Claude Code memory leak on Linux - conversation context never freed, causes system crash
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?
Environment:
- OS: Fedora Linux 43 (Workstation Edition)
- Kernel: 6.18.12-200.fc43.x86_64
- RAM: 16GB
- Claude Code version: 2.1.52 (Claude Code), Sonnet 4.6
- Platform: Linux x86_64
Description:
Claude Code accumulates memory continuously during a conversation and never releases it. The process eventually consumed 14GB+ of RAM, making the system unresponsive and forcing a hard reboot.
This does not occur on Windows.
What Should Happen?
Behaves like windows, or learn how codex does
Error Messages/Logs
Steps to Reproduce
Start Claude Code on Fedora Linux
Begin a conversation involving tool calls (especially bash commands with large output)
Run a tool that produces large output - e.g. journalctl
Watch memory in system monitor - it climbs and never drops
Continuing the conversation accelerates the growth
System becomes unresponsive
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.52 (Claude Code)
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
<img width="1034" height="80" alt="Image" src="https://github.com/user-attachments/assets/67d0834f-f9bd-4639-9e81-df0ad50e58ad" />
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗