A few considerations on garbage collection

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 30 13:29:38 PDT 2014


On 4/30/14, 11:15 AM, Dmitry Olshansky wrote:
> It doesn't and CAN'T. As long as there is a pointer into the block it
> stays. There are plenty of ways to shoot yourself in the foot if this
> rule is not respected. Anyhow, for starters, a conservative GC doesn't
> know what is a slice when ptr/length sits in registers!

Yah, if you find a register possibly pointing somewhere in the middle of 
an array, all bets are off.

But let's say that's not the case and all that's pointing in a 1M 
elements int[] is a int[] of 5 elements somewhere in the middle. Do we 
want to support these?

s = s.ptr[-1 .. $ + 1]

and such?


Andrei



More information about the Digitalmars-d mailing list