Garbage collected pointers?

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Mar 1 20:33:15 UTC 2018


On Thu, Mar 01, 2018 at 02:52:26PM -0500, Steven Schveighoffer via Digitalmars-d-learn wrote:
[...]
> There are a few in there, which I think are over-the-top. Such as
> "don't cast a pointer to a non-pointer",
[...]

Isn't that necessary for a precise GC?

Also, AIUI the current GC already does not scan size_t[] blocks for
pointers, so if you cast a pointer to size_t and put it in such an array
with no other references to your object, you stand the chance of the GC
collecting your object while it is still live.


> or "Do not take advantage of alignment of pointers to store bit flags
> in the low order bits".
[...]

Won't a precise GC scanning for pointers to aligned objects want to skip
values that can't be an aligned pointer?  Though in D's case, being
required to be conservative would negate this.


T

-- 
There are three kinds of people in the world: those who can count, and those who can't.


More information about the Digitalmars-d-learn mailing list