Introduction
VS Code runs extensions in a separate process called the Extension Host. When this process exceeds its memory limit, it crashes and all extension functionality stops working:
Extension host terminated unexpectedly.
Reason: Extension host stopped respondingThe editor itself continues to work (basic editing, navigation), but IntelliSense, linting, debugging, and all extension-provided features are unavailable until the host is restarted.
Symptoms
- Notification: "Extension host terminated unexpectedly"
- All IntelliSense, linting, and code actions stop working
- Extensions show as disabled or unresponsive
- Restarting the extension host temporarily fixes the issue but it crashes again
- VS Code process uses several gigabytes of RAM
Common Causes
- Memory-leaking extension (often language servers for large codebases)
- Very large workspace with thousands of files being indexed
- Multiple heavy extensions running simultaneously (ESLint, Prettier, TypeScript, Python)
- Workspace with large binary or generated files being scanned
- Known buggy extension version with memory leak
Step-by-Step Fix
- 1.Identify the crashing extension using the Process Explorer:
- 2.- Press
Ctrl+Shift+P - 3.- Type "Developer: Open Process Explorer"
- 4.- Look for the Extension Host process and check its memory usage
- 5.- Note the memory consumption (if over 1GB, it is likely the problem)
- 6.Start VS Code with extensions disabled to confirm:
- 7.```bash
- 8.code --disable-extensions
- 9.
` - 10.If the issue disappears, an extension is the cause.
- 11.Binary search to find the problematic extension:
- 12.- Disable half of your extensions
- 13.- Restart and test
- 14.- If the issue persists, the problem is in the enabled half
- 15.- Repeat until you isolate the culprit
- 16.Increase the extension host memory limit:
- 17.Launch VS Code with increased Node.js memory:
- 18.```bash
- 19.NODE_OPTIONS="--max-old-space-size=8192" code
- 20.
` - 21.Or add to your environment permanently.
- 22.Exclude large directories from file watching. In
.vscode/settings.json: - 23.```json
- 24.{
- 25."files.watcherExclude": {
- 26."/.git/objects/": true,
- 27."/.git/subtree-cache/": true,
- 28."/node_modules/": true,
- 29."/dist/": true,
- 30."/build/": true,
- 31."**/*.log": true,
- 32."/vendor/": true
- 33.},
- 34."search.exclude": {
- 35."**/node_modules": true,
- 36."**/bower_components": true,
- 37."**/*.code-search": true
- 38.}
- 39.}
- 40.
` - 41.Update or reinstall the problematic extension:
- 42.- Check the extension's marketplace page for known issues
- 43.- Update to the latest version
- 44.- If the latest version has the bug, downgrade to a known stable version
Prevention
- Keep all extensions updated to get memory leak fixes
- Exclude
node_modules,dist,build, and other generated directories from file watching - Use workspace-specific settings to limit extension scope
- Monitor extension memory usage periodically with the Process Explorer
- Avoid installing multiple extensions that provide the same functionality
- Use the built-in "Extension Bisect" feature:
Help: Start Extension Bisect - For large monorepos, consider using VS Code's multi-root workspace feature with focused folders
- Report memory leaks to extension authors with heap dumps from the Node.js inspector