Bug 1180 – the GC failes to handle large allocation requests propperly
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P3
Component
druntime
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2007-04-23T13:01:28Z
Last change time
2018-01-05T13:27:34Z
Keywords
pull
Assigned to
No Owner
Creator
Thomas Kühne
Comments
Comment #0 by thomas-dloop — 2007-04-23T13:01:28Z
Due to the size calculation used in all array length related GC functions
excessive allocation requests like
long[] l = new long[size_t.max];
allocate "(element_size * element_count) & 0xFFFF_FFFF" bytes and not
"element_size * element_count" bytes.
Even non-excessive requests like
byte[] b = new byte[size_t.max / 3];
fail with a segfault because bigAlloc uses "assert (0)" instead of
"_d_OutOfMemory".
Comment #1 by bugzilla — 2007-04-27T14:58:54Z
Fixed DMD 1.014
Comment #2 by dfj1esp02 — 2016-02-20T16:49:14Z
int main()
{
size_t len = size_t.max-100;
ubyte[] arr = new ubyte[len];
return 0;
}
Return code: 11 (Segmentation fault)
Tried only on dpaste.