Friday, March 04, 2005

On Finalizers and Destructors

I've been reading much on Finalizers and Destructors in Delphi for .NET because I wanted to understand garbage collection mechanism in depth. After reading couple of blog entries, I got confused. I used to use try...finally block in Delphi 7. I read that .NET doesn't require object to be destroyed as it uses automatic garbage collection method. I asked myself, do I still need to use try...finally method in Delphi 8? Finally, Nick's blog entry made everything clear. It says : "So, bottom line: Continue to call Free on the classes you create in your .Net applications. If there's no need for a Free call, no harm done. If there is a need for a Free call, then you've done it, and all is well. " There are some more articles which explain everything about GC or object destruction in .NET http://bdn.borland.com/article/0,1410,29365,00.html http://www.ftponline.com/vsm/2002_12/magazine/features/balena/default_pf.aspx

No comments: