GC
rikki cattermole via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jul 30 02:16:18 PDT 2017
On 30/07/2017 10:12 AM, piotrekg2 wrote:
> I would like to learn more about GC in D. For example can anyone explain
> why do we need memset(0) here:
> https://github.com/dlang/phobos/blob/master/std/container/array.d#L356 ,
> doesn't it assume a certain type of GC? What if there is a need to
> change the GC algorithm in the future?
>
> It would be great if you could point me out to articles on this subject.
Basically instead of having possibly random data in the array, it forces
it to be all 0.
What its protecting against is false pointers and stopping the GC seeing
a reference to a block of memory that doesn't exist.
It's just general protection against GC's thinking that memory is alive
when it isn't. More of a problem for 32bit than 64bit. Hasn't got much
to do with the algorithm :)
More information about the Digitalmars-d-learn
mailing list