Understanding Garbage Collection

In your applications you often create object instances or allocate memory for resources. When you perform these operations, .NET Framework checks for available memory in the heap. If available memory is not enough, .NET Framework launches a mechanism known as garbage collection, powered by an internal tool named garbage collector. The garbage collector can also be controlled by invoking members of the System.GC class, but the advantage is leaving .NET Framework the job of handling the process automatically for you. Basically the garbage collector first checks for all objects that have references from your applications, including objects referenced from other objects, enabling to keep alive object graphs. Objects ...

Get Visual Basic® 2010 Unleashed 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.