Force a gc before printing diagnostics

Use this together with `node --expose-gc` to get more stable results
This commit is contained in:
Arpad Borsos 2019-09-14 01:53:04 +02:00
parent a4bacf3bfa
commit 72c0961071

View File

@ -322,6 +322,10 @@ namespace ts {
const compilerOptions = program.getCompilerOptions();
if (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics) {
statistics = [];
// @ts-ignore
if (typeof gc === "function") { gc(); }
const memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1;
reportCountStatistic("Files", program.getSourceFiles().length);
reportCountStatistic("Lines", countLines(program));