Weak References

PJP pete.poulos at gmail.com
Wed Aug 6 15:53:49 PDT 2008


Is there any plan to add support for weak references to the D garbage collector?

Weak references are references which don't prevent the object from being garbage collected.  If it has been garbage collected then the weak reference returns null.

This is useful for things like resource caches, maintaining references to all instances of a specific class (ex: to implement an operation such as Window.minimizeAllWindows()), or to register a callback/listener with an object such that the registration won't prevent that object from being garbage collected.



More information about the Digitalmars-d mailing list