On Monday, 4 March 2019 at 10:38:29 UTC, KnightMare wrote:
For example, we have some rooted memory block as
auto rooted = new long[1_000_000];
1) conservative-GC will scan it for false pointers every GC-cycle. is it true?

Well, conservative GC in general might, but D's GC would NOT.

D's old GC is arguably semi-precise. It would scan void[] conservatively, anything that looks like a pointer is considered maybe a pointer. But it would NOT scan blocks allocated as long[] or ubyte[]. It would allocate those as NO_SCAN blocks.

The difference is in combination things, like the stack or structs with static blocks.

struct {
   int a;
   void* b;
}

The old GC would treat that whole struct as potentially pointers, both a and b. The new precise GC would know only b needs to be scanned inside that struct.

The even bigger deal with precise is it also knows only b would need to be changed if the pointer were to move - that's the big gain precise is setting the groundwork for, to enable moving GC optimizations.
  • precise GC KnightMare via Digitalmars-d-learn
    • Re: precise GC KnightMare via Digitalmars-d-learn
    • Re: precise GC KnightMare via Digitalmars-d-learn
    • Re: precise GC Adam D. Ruppe via Digitalmars-d-learn

Reply via email to