B
Barry Anderberg
I've been doing some reading about Finalize and garbage collection.
I've learned that finalizing should be avoided because objects that
have a finalize method require 2 (possibly more) itterations of the
garbage collector to run before the memory is returned to the heap.
The first time the GC runs the Finalize method is called, then the
second time the memory is actually freed.
The problem is that most of the major classes in the .NET framework
have a Finalize method.
The System.Windows.Forms.Control and System.Windows.Forms.Form classes
BOTH have finalize methods.
Am I to understand that I should always call GC.SuppressFinalize after
creating these objects?
Otherwise from what I have read it will take two or MORE garbage
collection cycles to free the memory!!
This seems wrong. Why would MS do this? I don't think they would
which makes me think there's some part of the picture I don't get.
Help!
I've learned that finalizing should be avoided because objects that
have a finalize method require 2 (possibly more) itterations of the
garbage collector to run before the memory is returned to the heap.
The first time the GC runs the Finalize method is called, then the
second time the memory is actually freed.
The problem is that most of the major classes in the .NET framework
have a Finalize method.
The System.Windows.Forms.Control and System.Windows.Forms.Form classes
BOTH have finalize methods.
Am I to understand that I should always call GC.SuppressFinalize after
creating these objects?
Otherwise from what I have read it will take two or MORE garbage
collection cycles to free the memory!!
This seems wrong. Why would MS do this? I don't think they would
which makes me think there's some part of the picture I don't get.
Help!