Introduction to Garbage Collection

Garbage-collected environments are systems that provide for high-speed memory allocation, automatic disposal of unused allocations, and automatic fragmentation management. This really means that unlike languages such as C, where you must manage your own memory allocations with functions like malloc(), Garbage Collectors (GCs) enable you to allocate what you need, when you need it, and the rest is managed for you.

Unfortunately, this often leads to a hands-off attitude by many programmers. They assume that because the GC is running in the background, nothing needs to be done with their code. The truth is that the GC can be your best friend and worst enemy, depending on how you write your code.

Garbage Collection ...

Get Microsoft® Visual C#® .NET 2003 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.