Number of references to a Class Object

Andrew Wiley debio264 at gmail.com
Fri Feb 11 23:24:47 PST 2011


On Sat, Feb 12, 2011 at 1:20 AM, d coder <dlang.coder at gmail.com> wrote:
> 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.

I believe what you're referring to is generally called a Weak
Reference, which is a reference that the GC doesn't consider when
deciding to keep an object alive, but that the GC will update if an
object dies.
There's a feature request at http://d.puremagic.com/issues/show_bug.cgi?id=4151


More information about the Digitalmars-d-learn mailing list