IDEA: invariant-related gc hints
Russell Lewis
webmaster at villagersonline.com
Thu Jul 24 15:17:48 PDT 2008
Say that you create a new variable on the heap. You fill it up with
data, then cast it to invariant because you know that the contents will
never change again.
That object might become garbage, of course, but you know that nothing
it points to can possibly become garbage until the root object (the one
that you cast to invariant) becomes garbage.
It seems to me that this information would be useful to the GC. Just
brainstorming here...but certainly, we could say, "until object X is
garbage collected, objects A,B,C,D should all get marked 'live' in every
GC sweep."
Moreover, the GC knows that all accessible data is also invariant, at
least until the root reference goes away, so none of those objects need
to be re-swept during a mark-and-sweep pass.
This sort of knowledge might really improve performance on programs that
had a large set of invariant data.
Other ideas?
More information about the Digitalmars-d
mailing list