[Issue 13111] New: GC.realloc returns invalid memory for large reallocation
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Jul 12 10:10:30 PDT 2014
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 at puremagic.com
Reporter: r.sagitario at 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++;
}
}
--
More information about the Digitalmars-d-bugs
mailing list