On Wednesday, 9 November 2022 at 11:55:28 UTC, Guillaume Piolat wrote:
>I've been avoiding void[] for this reason (I mean, void[] could contain pointers), but I think I'm cargo-culting this?
If I do:
ubyte[] arr = new ubyte[100_000_000];
void[] arr2 = cast(void[]) arr; // will this still avoid scanning?
Does the GC still know that this area is NO_SCAN?
Yes (as per Adam's post).
However, it's easy to lose it with operations like concatenation or appending. a ~ b
will allocate void[]
(without NO_SCAN
) if either are void[]
. This is why I still use ubyte[]
(or, in ae, Data
/ DataVec
) for raw data.