Object Life Cycle
This chapter has focused on how objects and values are allocated and referenced. There has been no mention of how or when programmers reclaim the underlying memory an object resides in over the lifetime of a running program. This is a feature. One of the primary benefits of the CLR's managed execution mode is that memory reclamation is no longer the purview of the programmer. Rather, the CLR is responsible for all memory allocation (and deallocation). The policies and mechanisms used by the CLR for managing memory are the subject of the remainder of this chapter.
The CLR is aware of all object references in the system. Based on this global knowledge, the runtime can detect when an object is no longer referenced. The runtime ...
Get Essential .NET, Volume 1: The Common Language Runtime 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.