Reddit: SafeD - The Safe Subset of D

Sean Kelly sean at invisibleduck.org
Mon Mar 31 10:10:33 PDT 2008


== Quote from Kevin Bealer (kevinbealer at gmail.com)'s article
> Mark/sweep doesn't have the problem of circular reference counts, but on
> the other hand, there is no way to figure out which blocks were parents
> of which others, so that destruction order is essentially random.  There
> is no way to fix this reliably, especially since the circular links can
> mean that the objects are both parents of each other -- so what order do
> they get destroyed in?

This should probably be qualified by saying that there is no efficient way to
find the parent object, and in the case of circular chains, there may not even
be a parent object.  However, in the general case the GC could theoretically
maintain enough bookkeeping information to destroy objects hierarchically
when possible.  But I suspect that doing so would greatly increase both the
memory needed for a scan and the time involved.  Thus, guaranteeing in-
order destruction simply isn't practical, even when it's possible.


Sean


More information about the Digitalmars-d-announce mailing list