microsoft / microsoft/TypeScript

Heap out of memory on version 4.2

Open
#42,989 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Investigation
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Bug Report

🔎 Search Terms
  • memory
🕗 Version & Regression Information

On a Vue project the compiler crashes with Heap out of memory. This does not happen on version 4.1.3.

⠙  Building for production...Starting type checking service...
Using 1 worker with 2048MB memory limit
⠼  Building for production...
<--- Last few GCs --->

[34642:0x41419c0]   211431 ms: Scavenge 956.0 (980.7) -> 940.2 (980.7) MB, 0.3 / 0.0 ms  (average mu = 0.996, current mu = 0.994) allocation failure 
[34642:0x41419c0]   211566 ms: Scavenge 956.0 (980.7) -> 940.2 (980.7) MB, 0.3 / 0.0 ms  (average mu = 0.996, current mu = 0.994) allocation failure 
[34642:0x41419c0]   211705 ms: Scavenge 956.0 (980.7) -> 940.2 (980.7) MB, 0.3 / 0.0 ms  (average mu = 0.996, current mu = 0.994) allocation failure 


<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 0xa9c298dbf1d]
Security context: 0x29d2e9a1e6c1 <JSObject>
    1: parseList(aka parseList) [0x292d524ccc59] [/home/qp/IdeaProjects/MyEtherWallet/node_modules/typescript/lib/typescript.js:~30031] [pc=0xa9c29c58125](this=0x3ba7b93026f1 <undefined>,kind=0,parseElement=0x292d524cfa99 <JSFunction parseStatement (sfi = 0x3ef7041e4489)>)
    2: parseSourceFileWorker(aka parseSourceFileWorker) [0x292d524cbb99] [/home/qp/Idea...

FATAL ERROR: invalid array length Allocation failed - JavaScript heap out of memory
 1: 0x8fb090 node::Abort() [/home/qp/.nvm/versions/node/v10.23.3/bin/node]
 2: 0x8fb0dc  [/home/qp/.nvm/versions/node/v10.23.3/bin/node]
 3: 0xb033be v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/home/qp/.nvm/versions/node/v10.23.3/bin/node]
 4: 0xb035f4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/home/qp/.nvm/versions/node/v10.23.3/bin/node]
 5: 0xef7652  [/home/qp/.nvm/versions/node/v10.23.3/bin/node]
 6: 0xed0734 v8::internal::Factory::NewFixedArrayWithFiller(v8::internal::Heap::RootListIndex, int, v8::internal::Object*, v8::internal::PretenureFlag) [/home/qp/.nvm/versions/node/v10.23.3/bin/node]
 7: 0xed0d07 v8::internal::Factory::NewUninitializedFixedArray(int, v8::internal::PretenureFlag) [/home/qp/.nvm/versions/node/v10.23.3/bin/node]
 8: 0xe8408f  [/home/qp/.nvm/versions/node/v10.23.3/bin/node]
 9: 0x112a71d v8::internal::Runtime_GrowArrayElements(int, v8::internal::Object**, v8::internal::Isolate*) [/home/qp/.nvm/versions/node/v10.23.3/bin/node]
10: 0xa9c298dbf1d 
⠼  Building for production...Type checking and linting aborted - probably out of memory. Check `memoryLimit` option in ForkTsCheckerWebpackPlugin configuration.
⠏  Building for production...
⏯ How to reproduce:
  1. Use Node 10
  2. git clone --branch 21-add-typescript-support git@github.com:theqp/MyEtherWallet.git
  3. Change typescript to 4.2.2 (it would work otherwise)
  4. npm i
  5. echo "" > package-test.js && NODE_OPTIONS="--max-old-space-size=4096" npm run build
  6. Wait for the crash :D

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Node 10 build using the listed MyEtherWallet branch, TypeScript 4.2.2, and the npm run build command. Inspect the parseList and parseSourceFileWorker stack entries in node_modules/typescript/lib/typescript.js, along with the ForkTsCheckerWebpackPlugin memoryLimit configuration. Done means the 4.2.2 build completes without exhausting the JavaScript heap while the regression remains covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
compilers, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.