[D-runtime] [GC] Object collection dependencies
Jonathan M Davis
jmdavisProg at gmx.com
Sat May 12 04:05:07 PDT 2012
On Saturday, May 12, 2012 12:59:30 Alex Rønne Petersen wrote:
> Hi,
>
> Given two objects A and B, I need a way to make it such that A will
> always outlive B (i.e. A will never be collected before B is). This
> needs to hold regardless of whether A and B have any references to
> each other.
>
> I don't think there's any way to do this at present. How hard would it
> be to implement this with D's current GC?
>
> I'm asking since this would facilitate a nice, sort-of hack-free
> implementation of weak references.
Isn't the language and GC specifically designed so that it's not supposed to
care about such ordering (e.g. freeing GC memory is illegal in finalizers
specifically because any objects referred to by that object could already have
been freed)?
- Jonathan M Davis
More information about the D-runtime
mailing list