Binarysharp.Benchmark.Components.GcMemoryOptimizer.OptimizeMemory C# (CSharp) Method

OptimizeMemory() public method

Optimizes the memory of the current process by forcing a garbage collection.
public OptimizeMemory ( ) : void
return void
        public void OptimizeMemory()
        {
            // Forces garbage collection
            GC.Collect();
            // Suspends the current thread until the thread that is processing the queue of finalizers has emptied that queue
            GC.WaitForPendingFinalizers();
            // Forces garbage collection one more time to eliminate finalized objects
            GC.Collect();
        }
GcMemoryOptimizer