Appendix D. Garbage Collection

As is the case with Java, a Microsoft .NET programmer will usually not take an interest in the operational details of garbage collection and can safely assume that unreferenced objects will be collected as required. This appendix, however, covers some of the features that are available when the default behavior of the garbage collector (GC) doesn’t meet the demands of an application; we expect the reader to be familiar with the principles of garbage collection.

Controlling the Garbage Collector

The System.GC class provides methods to directly control the execution of the garbage collector. The garbage collector is designed to determine the best time to perform a collection; however, in some situations forcing a collection ...

Get C# for Java Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.