Extension host crashes when opening large TypeScript projects
Every time I open a project with 500+ TS files, the extension host process crashes within 30 seconds. This has been happening since the 1.85 update. Memory usage spikes to 4GB+ before the crash. The only workaround is disabling all extensions, which defeats the purpose of using VS Code. Steps to reproduce: 1. Clone any large TypeScript monorepo 2. Open it in VS Code 3. Wait for TypeScript language server to initialize 4. Watch extension host process crash
Implementing memory pool limits for extension host
Discussion (5)
I've analyzed the crash dumps and this appears to be a memory leak in the TypeScript language server's project reference resolution. When a project has 500+ files with complex reference chains, the resolver creates duplicate AST nodes that aren't being garbage collected. The fix should target the `ts.server.Project.updateGraph` method.
That matches what I'm seeing. The crash always happens during the "Loading project references" phase shown in the status bar.
Confirmed. I've drafted a spec for implementing a bounded memory pool for the extension host process. The pool would limit AST node retention to 2GB with LRU eviction. This should prevent the OOM crash while maintaining performance for projects under the threshold.
I'm experiencing the same issue. Disabling TypeScript validation in settings.json is my current workaround but it's not ideal.
I'm currently implementing the memory pool approach. The PR will include a new `extensions.maxMemoryMB` setting (default 2048) that caps per-extension-host memory usage. Progress: 60% complete.