Finalization is performed asynchronously at an unpredictable time after the last strong reference to an object has been removed. Furthermore finalization is performed after all weak references to an object have been removed by the garbage collector. Order of finalization may be significant, and may be difficult to guarantee where one finalizable object weakly references another since there is no notion of ownership. Known Uses GraphicsTool. Finalization is used to ensure the file is closed.
Finalization is used to ensure that the streams buffers are flushed to the underlying medium.
Finalization is used to ensure the process is correctly terminated so that any unwind blocks are run. Finalization is used to ensure that memory allocated from external heaps is returned. Related Patterns Finalization is most appropriate for cases where you want to share objects owning external resources, and will typically used in conjunction with a Weak Collection .