[BUG] [Linux] Massive RAM spike (300MB → 10GB) due to background indexation
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.159
- OS: Ubuntu Linux, kernel 6.17.0-35-generic
- RAM: 16GB
## Description
Once or twice a week, when Claude Code starts, a background process progressively consumes RAM
from ~300MB up to ~10GB, then drops back to ~300MB once complete.
If the process is interrupted before completion (e.g. system crash due to OOM),
it restarts from scratch at the next launch.
## Project context
- Django + React project
- node_modules: 628MB (697 packages)
- A .claudeignore file excluding node_modules/, __pycache__/, logs/ etc.
was added but had no effect on RAM consumption.
## Impact
The RAM spike consistently crashes the system when other applications
(IDE, browser) are already using significant memory.
What Should Happen?
Indexation should either:
- Be cached persistently on disk so it doesn't repeat on every startup, or
- Use a reasonable amount of RAM (< 1GB) for a typical project, or
- Respect .claudeignore to reduce scope
Error Messages/Logs
Steps to Reproduce
- Open Claude Code on a large Django/React project
- Leave it idle without sending any prompt
- Observe RAM usage climbing steadily from ~300MB to ~10GB over ~10 minutes
- RAM drops back to ~300MB once the process completes
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.159
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
PyCharm terminal
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗