Help to find crash in simple stack type?
Rainer Schuetze via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jul 12 10:05:03 PDT 2014
On 12.07.2014 16:24, anonymous wrote:
> No explanation or solution, but a reduction:
>
> import core.memory;
> void main()
> {
> alias T = ubyte;
>
> enum size1 = 2_049; /* > 2_048 = 2^^11 */
> enum size2 = 1_048_577; /* > 1_048_576 = 2^^20 */
>
> T* _data;
> _data = cast(T*)GC.calloc(size1, GC.BlkAttr.NO_MOVE);
> _data = cast(T*)GC.realloc(_data, size2, GC.BlkAttr.NO_MOVE);
>
> T* _pointer = _data;
> foreach(i; 0 .. size2)
> {
> *_pointer = 0; /* segfault at i = 1_048_576 */
> _pointer++;
> }
> }
Thanks for the reduction. GC.realloc seems broken for reallocations to
sizes larger than the current GC pool.
Please file a bug report.
More information about the Digitalmars-d-learn
mailing list