Chute (gravity) - Wikipedia

Definition of garbage collection

Garbage Man / May 29, 2017

GC manages the virtual memory on the managed heap, which is the memory segment used to store and manage objects created in a managed process. If an object does not have any reference and cannot be reached or used, it becomes garbage. While GC performs a collection in a separate thread, all unusable objects are enumerated and the memory allocated to them is reclaimed.

Garbage collection is executed in situations such as when the system having low physical memory or where memory allocated in managed heap exceeds acceptable threshold value. Since the GC is executed periodically, there is generally no need to call the GC.Collect method.

The two options in which GC can be configured to specify the way by which the CLR need to perform are 1) workstation and, 2) server garbage collection. The key difference between the two is that the former occurs in the user thread that triggered the GC whereas the latter occurs on threads running at highest priority level. Also, workstation GC is always used on a system having single processor while the server GC is resource intensive with larger size segments and used in systems with multiple processors.

The two types of possible collections are full and partial types. A full collection is executed by stopping the program execution and visiting every object, following its object pointer and marking the object as reachable (or live) or unreachable (or condemned). After visiting the objects, the memory of the unreachable objects is reclaimed and the living objects are slided so the memory allocated is contiguous without any waste space in between. Partial collection searches only a part of heap and is used when full collection is found to be expensive.

Source: www.techopedia.com