private void CleanupCaches() { IConfigCache configCache = _componentFactories.GetComponent(BuildComponentType.ConfigCache) as IConfigCache; if (null != configCache) { configCache.ClearConfigurations(); } IResultsCache resultsCache = _componentFactories.GetComponent(BuildComponentType.ResultsCache) as IResultsCache; if (null != resultsCache) { resultsCache.ClearResults(); } if (Environment.GetEnvironmentVariable("MSBUILDCLEARXMLCACHEONCHILDNODES") == "1") { // Optionally clear out the cache. This has the advantage of releasing memory, // but the disadvantage of causing the next build to repeat the load and parse. // We'll experiment here and ship with the best default. s_projectRootElementCache = null; } // Since we aren't going to be doing any more work, lets clean up all our memory usage. GC.Collect(); }
/// <summary> /// Call the actual implementation /// </summary> public void ClearResults() { _clearedCount++; _resultCache.ClearResults(); }