# [BUG] Extreme memory and CPU usage on WSL2 causing system instability
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?
Preflight Checklist
- [x] I have searched existing issues and found related issue #15689
- [x] This is a single bug report
- [x] I am using a recent version of Claude Code
Environment
- Claude Code Version: 2.1.7
- OS: Windows 11 with WSL2 (Ubuntu)
- WSL Version: WSL2
- Hardware:
- CPU: Intel Core i7-13700HX (16 cores, 24 logical processors, 2100 MHz)
- RAM: 32GB (24GB allocated to WSL2)
- GPU: NVIDIA RTX 4070
- Terminal: VS Code Remote - WSL
Description
Claude Code consumes excessive memory and CPU resources on WSL2, eventually causing VS Code to lose connection to WSL. This appears related to #15689 but involves sustained high resource usage beyond just the slash command menu.
Observed Behavior
Memory and CPU usage grow unbounded during normal usage:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2262 furkan 20 0 73.2g 21.1g 28224 R 340.7 89.7 7:36.99 claude
- Virtual memory: 73.2 GB
- Resident memory: 21.1 GB (89.7% of available WSL memory)
- CPU: 340%+ sustained
This eventually causes:
- VS Code shows "Reconnecting to WSL..." modal
- Connection never recovers
- Requires
wsl --shutdownto restore functionality
Steps to Reproduce
- Install Claude Code on WSL2 Ubuntu
- Open a project in VS Code via Remote - WSL
- Start Claude Code and use it normally (not just slash commands)
- Monitor with
top- observe memory climbing over time - Eventually VS Code loses connection to WSL
Expected Behavior
- Memory usage should remain stable during normal operation
- CPU should return to idle when not actively processing
- Should not destabilize the WSL environment
Workarounds Attempted
- Increased WSL memory allocation to 24GB (
.wslconfig) — delays but doesn't prevent the issue - Cleared VS Code server (
rm -rf ~/.vscode-server) — no effect - Verified inotify watches are high (524288) — not the cause
Diagnostic Data
Initial state:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2538 furkan 20 0 73.1g 4.7g 56064 S 29.9 30.7 0:34.16 claude
After ~10 minutes of use:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2262 furkan 20 0 73.2g 21.1g 28224 R 340.7 89.7 7:36.99 claude
Memory grew from 4.7GB to 21.1GB during normal usage session.
Related Issues
- #15689 - Slash command futex spinlock (related but this occurs outside of slash commands too)
- #14991 - High CPU usage when opening menu list with "/"
Additional Context
Running alongside Next.js dev server. The combination of both processes exhausts WSL memory allocation, but Claude Code is the primary consumer and continues growing unbounded.
Impact
Makes Claude Code unusable for extended sessions on WSL2. Users must periodically kill the process or restart WSL to continue working.
What Should Happen?
this happens only lately
Error Messages/Logs
Steps to Reproduce
run latest version on a next js project.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.7 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
_No response_
This issue has 13 comments on GitHub. Read the full discussion on GitHub ↗