GC of const/immutable reference graphs
John Colvin via Digitalmars-d
digitalmars-d at puremagic.com
Tue Sep 13 08:27:23 PDT 2016
For the following, lifetimeEnd(x) is the time of freeing of x.
Given a reference graph and an const/immutable node n, all nodes
reachable via n (let's call them Q(n)) must also be
const/immutable, as per the rules of D's type system.
In order to avoid dangling pointers:
For all q in Q(n), lifetimeEnd(q) >= lifetimeEnd(n)
Therefore, there is never any need for the GC to mark or sweep
anything in Q(n) during the lifetime of n.
Does the GC take advantage of this in some way to reduce
collection times?
More information about the Digitalmars-d
mailing list