Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition
by Paul J. Deitel - Deitel & Associates, Inc., Harvey M. Deitel - Deitel & Associates, Inc.
9.9. Garbage Collection
Every object you create uses various system resources, including the memory that holds the object itself. We need a disciplined way to give resources back to the system when they are no longer needed, so as to avoid “resource leaks.” The Common Language Runtime (CLR) performs automatic garbage collection to reclaim the memory occupied by objects that are no longer in use. When there are no more references to an object, the object is marked for garbage collection by the CLR. The memory for such an object can be reclaimed when the runtime executes its garbage collector, which is responsible for retrieving the memory of objects that are no longer used, so that the memory can be used for other objects. Therefore, whereas ...
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