[BUG] Unbounded memory usage in LXD VMs where tool calling is used (CLI + VSCode Extension)
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?
I've recently shifted to working inside a VM, and connecting Visual Studio Code to the VM using the VS Code Remote extension.
Any time I start a chat that requires some tool-calling, for example "run the project's pre-commit hooks", within 1-2 minutes the Claude Code exhausts all memory on the machine (48GB in my last attempt), which results in the VM becoming unresponsive and things getting OOM-killed.
If I ask the same thing in an SSH session in my normal terminal, just running claude and typing the same prompt, it behaves perfectly normally most of the time, but does still exhibit the same behaviour.
As it's happening, there appear to be thousands of bash processes appearing in htop, but they're orphaned from code-server or claude, so even killing these processes doesn't stop the memory growth.
I've only seen this in LXD VMs, though the VMs and my host are running the same version of Ubuntu.
What Should Happen?
I should see similar memory performance in the extension and with claude in a regular SSH session
Error Messages/Logs
Steps to Reproduce
- Create a new cloud VM or local VM with lima/multipass/lxd
- Connect to the VM with VS Code remote, install the Claude Extension
- Open a seperate SSH session on the machine in a terminal, run htop to monitor
- Create a project with a simple pre-commit check or linting task, or the need to troubleshoot logs in a clsuter
- Ask Claude to "check the logs" or "run the precommit checks"
Example here of me asking Claude to collate logs from my kubernetes cluster, and all the processes being spawned for snapshots, which soon grew out of control and tanked the VM:
<img width="2732" height="2119" alt="Image" src="https://github.com/user-attachments/assets/87b4061e-8f8b-45ec-bea5-321e0760fc7e" />
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.101
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
Happy to provide any other information I can!
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗