why does clearing an array set its capacity to 0?
Vlad Levenfeld via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jul 1 18:14:27 PDT 2014
> How did you allocate your array? The GC has the APPENDABLE
> attribute special for memory blocks that are going to be used
> as slices:
I allocated with new T[n]. I've tried allocating with both the
APPENDABLE and NO_SCAN blocks but beyond a certain allocation
size this doesn't work, I get a reported capacity of 0 and any
append reallocates. (8000 does it for me, I haven't looked for
the lower bound)
> Are you doing bounds checking for your array? Try the
> -boundscheck=off compiler flag. (That may be new in 2.066.
> Otherwise, try -noboundscheck.)
I had it set through dub's "buildOptions". Will there be a @nogc
or @noheap flag in 2.066? I read some forum posts about it but
can't seem to find whether it will be part of the next release.
More information about the Digitalmars-d-learn
mailing list