What is garbage collection ?
Like a Java Virtual Machine, the CLR removes the burden of memory management from developers by destroying objects once they are no longer being referenced. Before an object is removed from memory, it must free any resources it has allocated during its lifetime. In C++, this “cleanup code” is usually housed in an object’s destructor, whereas in VB it is placed in the Class Terminate () method. Under the .NET Framework, cleanup code must reside in an object’s Finalize () method, which is called just before the object is garbage-collected by the CLR. Finalize () is a method in the System.Object class from which all other .NET classes derive. You only have to override this method when you have cleanup code that should be performed before the class is destroyed.
For performance reasons, the Finalize () method should only be employed when efficiently freeing a particular resource is a prime concern.
