Regarding Dispose and Finalize methods in Garbage Collection

can any one help me to know more about Finalize and Dispose methods in Garbage collection


Answer this question

Regarding Dispose and Finalize methods in Garbage Collection

  • BensonFabonan

    I know you're trying to keep it simple here, but it's definitely worth pointing out that finalizers are absolutely not analagous in functionality to C++ destructors. Destructors are deterministic and thus make sense to use for object clean-up whereas finalizers are not, and generally don't.


  • CET PRG455

    Search engines are your friend:

    http://www.google.co.uk/search sourceid=navclient-ff&ie=UTF-8&rlz=1B2GGGL_enIE177&q=Finalize+Dispose+Garbage+collection

    All of the top posts are useful and answer your question.


  • Schwarzer Schmetterling

    Finalizers are functions that the GC promises to call on seemingly dead objects before it reclaims memory for that object. Its very similar in syntax to c++ destructors and analogous in functionality. Without going into too much detail, finalizers are bad as they keep the object alive longer than its intended life. If possible avoid using finalizers.

    The Dispose method is on objects that implement the IDisposable interface. This is an alternative method that allows programmer (Who knows the lifetime of the object) to release resources early and therefore not need finalization.

    For more information on GC, Finalizers and IDisposable see

    http://msdn.microsoft.com/library/default.asp url=/library/en-us/dndotnet/html/dotnetGCbasics.asp



  • Regarding Dispose and Finalize methods in Garbage Collection