From 0c9510e6f1527babeaf30c227a59c48b883647f2 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 4 Aug 2014 17:23:09 -0700 Subject: [PATCH] Wire cleanupSemanticCache --- src/services/services.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index 849b43fa50..aaac93c9ee 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1299,7 +1299,7 @@ module ts { if (programUpToDate()) { return; } - + var compilationSettings = hostCache.compilationSettings(); // Now, remove any files from the compiler that are no longer in the host. @@ -1372,6 +1372,15 @@ module ts { typeChecker = program.getTypeChecker(); } + /// Clean up any semantic caches that are not needed. + /// The host can call this method if it wants to jettison unused memory. + /// We will just dump the typeChecker and recreate a new one. this should have the effect of destroying all the semantic caches. + function cleanupSemanticCache(): void { + if (program) { + typeChecker = program.getTypeChecker(); + } + } + function dispose(): void { if (program) { forEach(program.getSourceFiles(), @@ -2180,7 +2189,7 @@ module ts { return { dispose: dispose, refresh: () => { }, - cleanupSemanticCache: () => { }, + cleanupSemanticCache: cleanupSemanticCache, getSyntacticDiagnostics: getSyntacticDiagnostics, getSemanticDiagnostics: getSemanticDiagnostics, getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics,