The GC Class
The GC class publishes services to interface with the garbage collector. You can manipulate and monitor garbage collection with the GC class. While some of the commands provide status information, other GC commands affect the default behavior of garbage collection. Table 17-2 lists the static members of the GC class.
Table 17-2. GC class static members
Member name | Description |
|---|---|
MaxGeneration | This property is an integer property and returns the maximum number of generations. |
AddMemoryPressure | This method recognizes memory allocations for unmanaged resources. |
Collect | This method forces garbage collection on a specific generation. There are two overloads of the method. The no-argument Collect does garbage collection on all generations. The one-argument ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access