digitalmars.D.bugs - [Issue 13111] New: GC.realloc returns invalid memory for large
- via Digitalmars-d-bugs (32/32) Jul 12 2014 https://issues.dlang.org/show_bug.cgi?id=13111
https://issues.dlang.org/show_bug.cgi?id=13111 Issue ID: 13111 Summary: GC.realloc returns invalid memory for large reallocation Product: D Version: unspecified Hardware: x86_64 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: r.sagitario gmx.de Reported by Gary Willoughby, reduced by anonymous: 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++; } } --
Jul 12 2014