www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Number of references to a Class Object

Greetings

I am in a situation where I need to know the number of references to a
class' object. To explain, I have an array of class objects and I
occasionally process this array. But if a particular object in this
array is not being garbage collected just because it is part of this
array, I would like to loose that object by making it null.

So either I need to find out the number of references to that object
and in case there is only one reference, I force the object null. If
this is not possible, I am sure there would be alternative solutions
since this should be a common situation faced by programmers.

Please help.

Regards
- Cherry
Feb 11 2011