Help to find crash in simple stack type?
anonymous via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jul 12 07:24:29 PDT 2014
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++;
}
}
More information about the Digitalmars-d-learn
mailing list