microsoft / microsoft/TypeScript
Bug Report: Severe memory leak triggered by "TypeScript (Native Preview)" extension
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 132
描述
🔎 Search Terms
Note: this issue is updated version of https://github.com/microsoft/TypeScript/issues/63849
🕗 Version & Regression Information
Extension identifier: typescriptteam.native-preview
Extension version: 0.20260708.2
VS Code Version: 1.134
Operating system Version: Ubuntu 22.04
The bug reproduces with and without the "TypeScript 7 Nightly" extension
Identifier: typescriptteam.vscode-typescript-nightly
Version: 0.20260826.1
I used this extension to have the latest version of TypeScript (with TypeScript: Select TypeScript Version -> Use TypeScript 7).
⏯ Playground Link
No response
💻 Code
Steps to reproduce
- Create a new empty folder and create a single blank file named
index.tsinside it. It is important to have many other git repositories nearby (e.g.../*). - Disable the "TypeScript (Native Preview)" extension in VS Code.
- Open the newly created folder in VS Code.
- Open the
index.tsfile (this step is required to trigger the behavior). - Check the system monitor: memory consumption remains normal/baseline (~4.1 GB total system load).
- Enable the "TypeScript (Native Preview)" extension.
- Observe the system monitor: memory consumption starts growing rapidly.
- Disable the extension and run the "Restart Extensions" command (do not close VS Code yet).
- Observe that the memory leak continues unabated (climbing up to ~14.6 GB / 87.5% RAM usage).
- Close VS Code completely: the memory leak stops.
Important clarification: When I add the default package.json file to the folder using the following command, there is no memory leak.
npm init -y
🙁 Actual behavior
Memory usage spikes dramatically and is never reclaimed until the entire VS Code application is shut down.
Screenshots
- Baseline / Normal state (~4.1 GB):
- Leaked state (~14.6 GB after enabling/disabling the extension):
🙂 Expected behavior
Enabling the extension on an empty file should not cause massive memory consumption. Disabling the extension or restarting extensions should terminate the underlying leaked processes and free up the allocated RAM.
Additional information about the issue
The CPU is also used quite actively. On the penultimate screen you can see the memory consumption curve.
The moment VS Code closes
You see a spike first - this is when VS Code is closed. And then the memory does not return to normal.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用 typescriptteam.native-preview 扩展、空的 index.ts 和附近的 Git 仓库重现内存泄漏,然后比较使用 npm init -y 添加 package.json 后的行为。调查扩展启用、禁用或重启时的进程和生命周期行为。完成标准是内存保持稳定,并且禁用或重启扩展后泄漏停止,同时无需关闭 VS Code。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- performance, tooling
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100