25 Nov
2007
25 Nov
'07
6:05 p.m.
Do you mean that you're planning to run the finalizer as part of the GC, just before it reclaims an object's memory? Tony Ramón García wrote:
I am thinking about optimizing the implementation of finalizing.
At present, finalizing imposes a high overhead to garbage collection. If an object has a finalizer, it must be collected twice, in case the finalizer creates a reference to the object somewhere. In the vast majority of cases this does not happen. The optimization would detect that the finalizer cannot create such references , and would mark the finalizer to run exactly before the memory of the object is released.
What would be the best place to insert this optimization? Any other ideas?