Skip to content
Discussion options

You must be logged in to vote

@ygc369 Finalizer is just a managed method. Placing in in the finalizer queue instead of simply calling the "Dispose" method directly will sinply result in worse performance.

Also, "this way object can be collected" in the next gc would actually be true for current gc because having ReferenceCount of 0 is basically similar to having no incoming references (unreachable). GC may collect it or not and it's up to the backing algorithm.

I think ultimately only a lifetime/ownership system can solve such issues. With such you could just write your own RC trackers or other things and be sure "Dispose" is called automatically when object goes out of scope.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ygc369
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
4 participants