24-Jan-2014 02:58, Martin Nowak пишет:
On 01/13/2014 10:16 PM, ilya-stromberg wrote:
It's not so good to have array of delegates because you will have a
memory leaks. Delegate has permanent pointer to the object, so GC will
never free it. As alternative, you can delete delegate manually, but in
this case you can have problems with manual memory management.
So, array of delegates is possible solution, but only for VERY simple
cases. This module solves problem with memory leaks because it
implements weak connections (based on weak reference). It's easy to use,
but VERY difficult to implement.
But weak references should be implemented on GC/druntime level.
It could be interesting to provide weak memory mapping with GC.
Could be very useful for caches.
--
Dmitry Olshansky