Free mag vol1 | Page 541

CHAPTER 13  UNDERSTANDING OBJECT LIFETIME System.GC Member Description GetTotalMemory() Returns the estimated amount of memory (in bytes) currently allocated on the managed heap. A Boolean parameter specifies whether the call should wait for garbage collection to occur before returning. MaxGeneration Returns the maximum number of generations supported on the target system. Under Microsoft’s .NET 4.0, there are three possible generations: 0, 1, and 2. SuppressFinalize() Sets a flag indicating that the specified object should not have its Finalize() method called. WaitForPendingFinalizers() Suspends the current thread until all finalizable objects have been finalized. This method is typically called directly after invoking GC.Collect(). To illustrate how the System.GC type can be used to obtain various garbage collection–centric details, consider the following Main() method, which makes use of several members of GC: static void Mai