File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1299,7 +1299,7 @@ module ts {
12991299 if ( programUpToDate ( ) ) {
13001300 return ;
13011301 }
1302-
1302+
13031303 var compilationSettings = hostCache . compilationSettings ( ) ;
13041304
13051305 // Now, remove any files from the compiler that are no longer in the host.
@@ -1372,6 +1372,15 @@ module ts {
13721372 typeChecker = program . getTypeChecker ( ) ;
13731373 }
13741374
1375+ /// Clean up any semantic caches that are not needed.
1376+ /// The host can call this method if it wants to jettison unused memory.
1377+ /// We will just dump the typeChecker and recreate a new one. this should have the effect of destroying all the semantic caches.
1378+ function cleanupSemanticCache ( ) : void {
1379+ if ( program ) {
1380+ typeChecker = program . getTypeChecker ( ) ;
1381+ }
1382+ }
1383+
13751384 function dispose ( ) : void {
13761385 if ( program ) {
13771386 forEach ( program . getSourceFiles ( ) ,
@@ -2180,7 +2189,7 @@ module ts {
21802189 return {
21812190 dispose : dispose ,
21822191 refresh : ( ) => { } ,
2183- cleanupSemanticCache : ( ) => { } ,
2192+ cleanupSemanticCache : cleanupSemanticCache ,
21842193 getSyntacticDiagnostics : getSyntacticDiagnostics ,
21852194 getSemanticDiagnostics : getSemanticDiagnostics ,
21862195 getCompilerOptionsDiagnostics : getCompilerOptionsDiagnostics ,
You can’t perform that action at this time.
0 commit comments