August 2002
Intermediate to advanced
576 pages
13h 54m
English
Finalization allows an object to release unmanaged resources it’s using before it’s collected. The .NET Object class defines the following method signature for this purpose:
protected override void Finalize();
During a collection run, the GC places all unreferenced objects in a finalize queue. This queue is then scanned, and the memory occupied by classes that don’t define a Finalize method is released. Objects that do define a Finalize method are placed on the freachable (pronounced F-Reachable) queue. A dedicated thread responsible for calling Finalize methods sleeps when no objects are in the freachable queue. When objects are added to the queue, the thread is awakened and calls the Finalize method.
A dedicated ...
Read now
Unlock full access