On Sunday, 16 November 2014 at 09:28:25 UTC, Rainer Schuetze
wrote:
On 15.11.2014 23:40, IgorStepanov wrote:
Do I any fundamental error in this code?
May be Bucket[] ret = new Bucket[len]; ret.ptr is not base
pointer?
Yes, for arrays larger than 2kB, the allocation length
information is placed before the actual data, and ret.ptr has
an offset of 16 bytes into the allocation block. As a
consequence, applying BlkAttr.NO_INTERIOR will very likely
cause the block to be collected. NO_INTERIOR has no effect for
smaller blocks.
That's why the existing AA code explicitely uses GC.malloc
instead of new[].
Thank you very much. That explains a lot.