[D1] gc safety

%u e at ee.com
Tue Oct 12 16:29:59 PDT 2010

== Quote from Simen kjaeraas (simen.kjaras at gmail.com)'s article
> %u <e at ee.com> wrote:
> > How gc unfriendly is an union of objects and sizet_t?
> >
> > union{
> >   size_t arr[10];
> >   Class obj[10];
> > }
> All elements of this union will be considered pointers by the GC.
The object will always occupy a continuous obj[0..x], is there some way to explain
this to the GC?

> > And, if multiple arrays contain exclusively the same objects, is it then
> > safe/useful to mark all but the smallest array with gc.hasNoPointers?
> > Any object removal/addition happens simultaneous across all the arrays.
> As long as there is at least one GC registered pointer to the allocated
> objects, it will not be collected. Hence, if some arrays are permutations
> or subsets of another array, only the original array need to be marked as
> having pointers.
Thanks :)
The GC will probably really like this as one of the arrays is cubed the size of
the smallest one :D

More information about the Digitalmars-d-learn mailing list