public void NotifyAboutGet() { Interlocked.Increment(ref _getCount); if (_getCount == _desiredGetCount) { Task.Run(() => { var sw = new Stopwatch(); sw.Start(); Console.WriteLine($"{DateTime.Now.ToLongTimeString()} Started preparation for POST"); //_swMemory = new System.Timers.Timer(1000); //_swMemory.Elapsed += (sender, args) => { TotalMemoryHelper.Show(); }; //_swMemory.Start(); StatusData.PrepareForUpdates(); CityData.PrepareForUpdates(); CountryData.PrepareForUpdates(); SNameData.PrepareForUpdates(); FNameData.PrepareForUpdates(); SexData.PrepareForUpdates(); PremiumData.PrepareForUpdates(); CodeData.PrepareForUpdates(); DomainData.PrepareForUpdates(); BirthYearData.PrepareForUpdates(); InterestsData.PrepareForUpdates(); JoinedYearData.PrepareForUpdates(); TotalMemoryHelper.Show(); GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce; GC.Collect(); GC.WaitForFullGCApproach(); TotalMemoryHelper.Show(); Console.WriteLine($"{DateTime.Now.ToLongTimeString()} Finished preparation for POST in {sw.ElapsedMilliseconds} ms"); }); } }