[BUG] Massive memory leak with Claude Code running in a WSL2 Ubuntu distro
Environment
- Platform (select one):
- [ ] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [X] Other: Claude Code
- Claude CLI version: 1.0.41 (Claude Code)
- Operating System: Windows 11
- Terminal: Ubuntu
Bug Description
I have a typescript project. The project has less than 100 files. When starting a new day, after a few prompts, Claude Code freezes. When looking at Task Manager, it's obvious Claude Code is abusing WSL2's virtual memory process. CPU, RAM, and Disk are all being thrashed by Claude Code. I have ensured only one Ubuntu terminal is open and only this distribution is running. Yet, this memory freeze occurs.
Steps to Reproduce
- Create a CLAUDE.md file in the Typescript project.
- Ensure the Typescript project is more than 50 files including code, unit tests, and integration tests. Ensure some unit tests are broken.
- Start Claude Code and set CWD to the directory of the Typescript project.
- Prompt Claude Code to run npm test and fix and broken unit tests.
Expected Behavior
Claude Code to not freeze.
Actual Behavior
Claude Code freezes and resource usage remained maxed out until wsl is shutdown.
Additional Context
Attached are two images. The image displaying Task Manager with the lowest resource usage is without Claude Code running. The image displaying the highest resource usage is after prompting Claude Code to run npm test and fix any broken unit tests.
!Image
!Image
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗