Hi again.
I was wondering if you couldn't simply catch any exception thrown from Delete, and do nothing with it.
Would look perfect to me.
Simple but slow method (pseudo-code of an hypothetic internal GC loop):
Another solution, almost as simple and with no overhead as long as no exception is thrown:
I have been thinking about how it may possibly restrict your GC implementation options, but quite frankly I can't find.
Given that it seems very doable to do it with no performance hit, it may be worth a look.
I was wondering if you couldn't simply catch any exception thrown from Delete, and do nothing with it.
Would look perfect to me.
Simple but slow method (pseudo-code of an hypothetic internal GC loop):
Local obj:Object = GetFirstObjectToFinalize() While ptr <> Null Try ' internally, saves all the information needed to unwind the stack if an exception is thrown (takes time) obj.Delete() Catch ex:Exception ' Do nothing, as if the Delete method had just exited ' Note: this is what the .Net Platform GC does End Try obj = GetNextObjectToFinalize(obj) WendThe problem of this version is that we pay for the Try, so even if no exception is thrown we incur a performance hit.
Another solution, almost as simple and with no overhead as long as no exception is thrown:
Local obj:Object = GetFirstObjectToFinalize() Try While ptr <> Null obj.Delete() .AfterFinalization obj = GetNextObjectToFinalize(obj) Wend Catch ex:Exception Goto AfterFinalization End TryThat is, you simply put the try/catch out of the loop that iterates over the objects that have a Delete method.
I have been thinking about how it may possibly restrict your GC implementation options, but quite frankly I can't find.
Given that it seems very doable to do it with no performance hit, it may be worth a look.