Once an object is up for garbage collection what happens to the object reference?Does the memory allocated to the reference be freed or will it just be set to null. What happens after its set to null?
Thank you
Bear Bibeault
Author and opinionated walrus
Marshal
I will first make my reference null and then the object is up for garbage collection.Now will the reference sit there untill eternity holding a null value.?
Bear Bibeault wrote:An object that has a reference is not eligible for garbage collection.
Except when it's part of an island of isolation - a set of objects that together cannot be reached from a live thread. An example is a List of elements; even though the List still has references to the elements, if those are the only references and the List is eligible for garbage collection, so are these elements.