public override State Execute(string input) { Process proc = Process.GetCurrentProcess(); Console.WriteLine("Total Memory: {0}", GC.GetTotalMemory(true) / (1024d * 1024)); Console.WriteLine("Deallocating memory..."); if (Repository.GlobalSymbolTable != null) { var symbols = Repository.GlobalSymbolTable.Symbols.Select(p => p.Value); var entities = symbols.SelectMany(s => s.Tuples).SelectMany(e => e); foreach (var qlEntity in entities) { SpatialRepository.RemoveMeshByGlobalId(qlEntity.GlobalId); } Reset(); } Console.WriteLine("Total Memory: {0}", GC.GetTotalMemory(true) / (1024d * 1024)); queryShowState.Execute(""); return(queryShowState); }
protected virtual void Reset()//todo check calls { Repository.GlobalSymbolTable.Reset(); Repository.GlobalEntityDictionary.Clear(); SpatialRepository.Reset(); GC.Collect(); GC.WaitForPendingFinalizers(); }