microsoft / microsoft/TypeScript

Bug Report: Severe memory leak triggered by "TypeScript (Native Preview)" extension

未关闭
#64,038 0 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 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
  1. Create a new empty folder and create a single blank file named index.ts inside it. It is important to have many other git repositories nearby (e.g. ../*).
  2. Disable the "TypeScript (Native Preview)" extension in VS Code.
  3. Open the newly created folder in VS Code.
  4. Open the index.ts file (this step is required to trigger the behavior).
  5. Check the system monitor: memory consumption remains normal/baseline (~4.1 GB total system load).
  6. Enable the "TypeScript (Native Preview)" extension.
  7. Observe the system monitor: memory consumption starts growing rapidly.
  8. Disable the extension and run the "Restart Extensions" command (do not close VS Code yet).
  9. Observe that the memory leak continues unabated (climbing up to ~14.6 GB / 87.5% RAM usage).
  10. 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):
Image
  • Leaked state (~14.6 GB after enabling/disabling the extension):
Image
🙂 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.

Image
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.

Image

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 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

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。