microsoft / microsoft/TypeScript

compiler memory leak in 5.8.x and upwards

オープン
#62,143 コメント 10 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Needs More Info
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

### 🔎 Search Terms

5.8, mem

### 🕗 Version & Regression Information

- This changed between versions 5.7 and 5.8

### ⏯ Playground Link

_No response_

### 💻 Code

https://github.com/fxdave/cuple/pull/new/typescript-issue-5-8-memory-leak

### 🙁 Actual behavior

```
$ npx tsc

<--- Last few GCs --->

[34857:0x559d92e7c000] 42329 ms: Scavenge (interleaved) 4081.2 (4090.1) -> 4078.8 (4098.6) MB, pooled: 0 MB, 5.79 / 0.00 ms (average mu = 0.281, current mu = 0.252) allocation failure;
[34857:0x559d92e7c000] 43481 ms: Mark-Compact (reduce) 4089.9 (4103.4) -> 4081.8 (4088.4) MB, pooled: 0 MB, 59.32 / 0.00 ms (+ 880.5 ms in 176 steps since start of marking, biggest step 5.5 ms, walltime since start of marking 998 ms) (average mu = 0.2
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

1: 0x559d50eec8b4 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [node]
2: 0x559d5140dd34 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
3: 0x559d5140de3b v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
4: 0x559d5169e0ac [node]
5: 0x559d516a4356 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [node]
6: 0x559d516a4467 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector, v8::base::TimeTicks) [node]
7: 0x559d516b3bc4 [node]
8: 0x559d516b6dd4 [node]
9: 0x559d52146ba7 [node]
fish: Job 1, 'npx tsc' terminated by signal SIGABRT (Abort)
```

### 🙂 Expected behavior

```
$ npx tsc
(List of type errors.)
```

### Additional information about the issue

NOTE:
It's not a node(24.4.1) issue, I tried with a different node version (node:22-bookworm from dockerhub).
The project is tiny.
I tried adding all my free rams to node (12GB) it ate it.

Steps to reproduce:
``` bash
# Download this branch: https://github.com/fxdave/cuple/pull/new/typescript-issue-5-8-memory-leak
git clone -b typescript-issue-5-8-memory-leak https://github.com/fxdave/cuple.git
cd cuple

# Setup:
npm i
make build # Important!

# run npx tsc in the tests folder
cd test
npx tsc
```

(the code contains errors, but that shouldn't matter.)

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

cuple リポジトリの typescript-issue-5-8-memory-leak ブランチで再現する: npm i を実行し、make build を実行してから、cd test を実行し、npx tsc を実行する。提供されたプロジェクトを使って TypeScript 5.8+ と 5.7 を比較し、ヒープを使い果たすのではなくコンパイルで型エラーが報告されることを確認する。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。