diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index d6c19e61bb..a5a3ec36fc 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -234,7 +234,9 @@ var sys: System = (function () { return (process).cwd(); }, getMemoryUsage() { - global.gc(); + if (global.gc) { + global.gc(); + } return process.memoryUsage().heapUsed; }, exit(exitCode?: number): void { diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 054b76c55b..ca5624875e 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -337,12 +337,16 @@ module ts { reportDiagnostics(errors); if (commandLine.options.diagnostics) { + var memoryUsed = sys.getMemoryUsage(); reportCountStatistic("Files", program.getSourceFiles().length); reportCountStatistic("Lines", countLines(program)); reportCountStatistic("Nodes", checker ? checker.getNodeCount() : 0); reportCountStatistic("Identifiers", checker ? checker.getIdentifierCount() : 0); reportCountStatistic("Symbols", checker ? checker.getSymbolCount() : 0); reportCountStatistic("Types", checker ? checker.getTypeCount() : 0); + if (memoryUsed) { + reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K"); + } reportTimeStatistic("Parse time", bindStart - parseStart); reportTimeStatistic("Bind time", checkStart - bindStart); reportTimeStatistic("Check time", emitStart - checkStart);