In this section, we will understand how the garbage collector performs finalization in the .NET Framework. To do finalization, it maintains two queues in the system:
- The finalization queue: The finalization queue is a data structure maintained by the garbage collector, which contains a reference to all the objects in a managed heap that have implemented the finalize method. Using this queue, the garbage collector essentially identifies all the objects that it needs to call the finalize method for in order to clean up the unmanaged code before the object can itself be destroyed.
- The fReachable queue: The fReachable queue is a data structure maintained by the garbage collector. It contains a reference to all the ...