Weak References

Jason House jason.james.house at gmail.com
Wed Aug 6 16:12:06 PDT 2008


A weak reference library exists but doesn't always work...

PJP Wrote:

> 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