Skip to content

JavaScript heap out of memory for 10s of MB of source #17112

@taoqf

Description

@taoqf

TypeScript Version: 2.4.1 / nightly (2.5.0-dev.20170707)

Code
gulpfile.js

// A *self-contained* demonstration of the problem follows...
gulp.task('compile-ts', () => {
	const ts = require('gulp-typescript');
	const tsProject = ts.createProject('./tsconfig.json');
	tsProject.options.module = 1;
	const dest = tsProject.options.outDir;
	return gulp.src('./src/**/*.ts')
		.pipe(tsProject())
		.pipe(gulp.dest(dest));
});

tsconfig.json

{
        "include": [
                "src"
        ],
        "compilerOptions": {
                "module": "commonjs",
                "target": "esnext",
                "noImplicitAny": false,
                "sourceMap": false,
                "emitDecoratorMetadata": true,
                "experimentalDecorators": true,
                "strictNullChecks": false,
                "noImplicitThis": true,
                "rootDir": "./src/",
                "rootDirs": [],
                "allowJs": false,
                "allowUnreachableCode": false,
                "allowUnusedLabels": false,
                "alwaysStrict": true,
                "baseUrl": "",
                "charset": "utf8",
                "declaration": false,
                "inlineSourceMap": false,
                "allowSyntheticDefaultImports": false,
                "diagnostics": false,
                "emitBOM": false,
                "forceConsistentCasingInFileNames": false,
                "importHelpers": false,
                "inlineSources": false,
                "isolatedModules": false,
                "lib": [
                        "es6",
                        "es7",
                        "dom"
                ],
                "listFiles": true, // default false
                "listEmittedFiles": true, // default false
                "locale": "zh_CN",
                "newLine": "CRLF",
                "noEmit": false,
                "moduleResolution": "node",
                "noEmitHelpers": false,
                "noEmitOnError": false,
                "noImplicitReturns": false,
                "noImplicitUseStrict": false,
                "maxNodeModuleJsDepth": 0,
                "noLib": false,
                "outDir": "./dist/",
                "noFallthroughCasesInSwitch": false,
                "noResolve": false,
                "noUnusedLocals": false,
                "noUnusedParameters": false,
                "paths": {},
                "preserveConstEnums": false,
                "pretty": true,
                "removeComments": false,
                "skipDefaultLibCheck": true, // default false
                "skipLibCheck": true, // default false
                "stripInternal": false,
                "suppressExcessPropertyErrors": false,
                "suppressImplicitAnyIndexErrors": true, // default false
                "traceResolution": true, // default false
                "typeRoots": [],
                "types": [],
                "watch": false
        }
}

Expected behavior:

Actual behavior:
Exception i got:

<--- Last few GCs --->

[24442:0x2def9d0]    58440 ms: Mark-sweep 1400.1 (1465.9) -> 1400.1 (1465.9) MB, 1948.3 / 0.0 ms  allocation failure GC in old space requested
[24442:0x2def9d0]    60312 ms: Mark-sweep 1400.1 (1465.9) -> 1400.1 (1434.9) MB, 1871.6 / 0.0 ms  last resort 
[24442:0x2def9d0]    62184 ms: Mark-sweep 1400.1 (1434.9) -> 1400.0 (1434.9) MB, 1871.8 / 0.0 ms  last resort 


<--- JS stacktrace --->

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

Security context: 0x3d1f48829891 <JS Object>
    2: write [/home/taoqf/feidao/temp/boai-h5-6/1/node_modules/typescript/lib/typescript.js:~9035] [pc=0x3cfdedb6fe70](this=0x1857e443e689 <an Object with map 0xddd4399bc9>,s=0x3c6749682c29 <String[4]: "id">)
    3: pipelineEmitExpression [/home/taoqf/feidao/temp/boai-h5-6/1/node_modules/typescript/lib/typescript.js:~66807] [pc=0x3cfdedbd085f](this=0xf51a038dbf9 <JS Global Object>,node=0x29110b...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [gulp]
 2: 0x13647ec [gulp]
 3: v8::Utils::ReportOOMFailure(char const*, bool) [gulp]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [gulp]
 5: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [gulp]
 6: v8::internal::Runtime_AllocateInTargetSpace(int, v8::internal::Object**, v8::internal::Isolate*) [gulp]
 7: 0x3cfded28437d
Aborted

More

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: PerformanceReports of unusually slow behavior

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions