[BUG] Memory leak - Claude Code 2.1.2 grows to 6-7GB RAM in short conversations
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
- Claude Code version: 2.1.2
- OS: Arch Linux (kernel 6.18.3)
- RAM: 8GB
- Node.js: (run
node --versionto get this)
Description
Claude Code consumes 6-7GB RAM within minutes of normal conversation, leading to OOM kills. This did not happen in previous versions.
Observed behavior
- Memory grows continuously during conversation
- Reaches 6-7GB within 2-3 minutes
- Gets killed by OOM killer
--max-old-space-size=2048does not help (process still grows to 4-5GB, suggesting native memory leak)
What Should Happen?
Memory should stay under 2-3GB for normal conversations.
Error Messages/Logs
OOM killer output:
oom-kill: task=claude, pid=2552, total-vm:74858512kB, anon-rss:6702608kB
Steps to Reproduce
Steps to reproduce
- Start Claude Code normally:
claude - Have a short conversation (5-10 messages)
- Monitor memory:
watch -n 1 'ps aux --sort=-%mem | head -3' - Observe RSS growing from ~1GB to 6-7GB rapidly
Workaround
Using systemd-run --user --scope -p MemoryMax=3G claude to hard-cap memory, but this causes frequent kills.
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
2.1.2 (Claude Code)
Platform
Anthropic API
Operating System
Arch Linux
Terminal/Shell
Ghostty
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/16325
- https://github.com/anthropics/claude-code/issues/12987
- https://github.com/anthropics/claude-code/issues/11315
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
i rolled back to 2.1.1 version and i cleared the cashe and history.json, now it is working appropriate
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.