diff --git a/ets2panda/linter/src/lib/LinterRunner.ts b/ets2panda/linter/src/lib/LinterRunner.ts index 3696ab689847981cb15187c1ebe1df7d86d73555..eca6c7eac11f47a1b923c90bd4a5865aec40df6a 100644 --- a/ets2panda/linter/src/lib/LinterRunner.ts +++ b/ets2panda/linter/src/lib/LinterRunner.ts @@ -238,6 +238,7 @@ function migrate( const updatedSourceTexts: Map = new Map(); let lintResult: LintRunResult = initialLintResult; const problemsInfosBeforeMigrate = lintResult.problemsInfos; + tiggerGc(); const migrationMaxPass = cmdOptions.linterOptions.migrationMaxPass ?? qEd.DEFAULT_MAX_AUTOFIX_PASSES; for (let pass = 0; pass < migrationMaxPass; pass++) { @@ -252,6 +253,7 @@ function migrate( // Re-compile and re-lint project after applying the fixes. linterConfig = compileLintOptions(cmdOptions, getMigrationCreateProgramCallback(updatedSourceTexts)); lintResult = lintImpl(linterConfig, { currentPass: pass, maxPasses: migrationMaxPass }); + tiggerGc(); } // Write new text for updated source files. @@ -267,6 +269,12 @@ function migrate( return lintResult; } +function tiggerGc(): void { + if (global && global.gc && typeof global.gc === 'function') { + global.gc(); + } +} + function filterLinterProblemsWithAutofixConfig( cmdOptions: CommandLineOptions, problemsInfos: Map