static void arrays under garbage control?
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Feb 26 11:28:59 PST 2015
On 02/26/2015 10:07 AM, Steven Schveighoffer wrote:
>> // will not be scanned by GC for pointers:
>> void[] buffer4 = cast(void[])(new ubyte[16]);
>> uint[] buffer5 = cast(uint[])(new ubyte[16]);
>
> Correct, since they are allocated as ubyte[]. uint[] also would not be
> scanned.
I've been under the impression that current GC being imprecise, even an
unfortunate bit-pattern in an int would keep otherwise dead objects
alive. Is that still true for a single int?
And is 'new int[N]' better in this regard because it never keeps objects
alive?
Ali
More information about the Digitalmars-d-learn
mailing list