Skip to content

Out of memory error when using ImmutableJS #17070

@sccolbert

Description

@sccolbert

Simply importing the type definitions of ImmutableJS is enough to crash the compiler with an out of memory exception.

TypeScript Version: 2.4.1

index.ts

import 'immutable';

package.json

{
  "private": true,
  "name": "scratch",
  "version": "0.0.1",
  "dependencies": {
    "immutable": "4.0.0-rc.2"
  },
  "devDependencies": {
    "typescript": "^2.4.1"
  },
  "scripts": {
    "build": "tsc"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "declaration": true,
    "noImplicitAny": true,
    "noEmitOnError": true,
    "noUnusedLocals": true,
    "module": "commonjs",
    "moduleResolution": "node",
    "target": "ES5",
    "lib": ["ES5"],
    "types": []
  }
}

Expected behavior:

npm run build should execute cleanly.

Actual behavior:

Out of memory error:

E:\Development\sccolbert\scratch>npm run build

> scratch@0.0.1 build E:\Development\sccolbert\scratch
> tsc


<--- Last few GCs --->

   24342 ms: Mark-sweep 1373.9 (1434.6) -> 1373.9 (1434.6) MB, 1130.9 / 0.0 ms [allocation failure] [GC in old space requested].
   25469 ms: Mark-sweep 1373.9 (1434.6) -> 1373.7 (1434.6) MB, 1126.1 / 0.0 ms [allocation failure] [GC in old space requested].
   26600 ms: Mark-sweep 1373.7 (1434.6) -> 1374.9 (1418.6) MB, 1131.4 / 0.0 ms [last resort gc].
   27744 ms: Mark-sweep 1374.9 (1418.6) -> 1376.0 (1418.6) MB, 1143.2 / 0.0 ms [last resort gc].


<--- JS stacktrace --->

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

Security context: 00000294DA0CFB61 <JS Object>
    1: getTypeOfSymbol [E:\Development\sccolbert\scratch\node_modules\typescript\lib\tsc.js:~25490] [pc=000003AB5C58E243] (this=000000CA3E8662F9 <JS Global Object>,symbol=000001704DD798E1 <a Symbol with map 0000003478D59B29>)
    2: forEachMatchingParameterType [E:\Development\sccolbert\scratch\node_modules\typescript\lib\tsc.js:~30013] [pc=000003AB5C4F801C] (this=000000CA3E8662F9 <JS Global ...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issueHigh Priority

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions