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.
Comment #3 by r.sagitario — 2016-03-30T21:00:00Z
This is unlikely a recent regression, it's already in dmd 2.067. https://github.com/D-Programming-Language/druntime/pull/1528
Comment #4 by github-bugzilla — 2016-04-08T22:57:28Z
Commit pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/6dbe4d82c074561ddb23525b23cd9cf599e4a5ce Merge pull request #1528 from rainers/fix_1180 Fix Issue 1180 - the GC failes to handle large allocation requests propperly
Comment #5 by github-bugzilla — 2016-10-01T11:44:41Z
Comment #6 by github-bugzilla — 2018-01-05T13:27:34Z
Commit pushed to dmd-cxx at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/6dbe4d82c074561ddb23525b23cd9cf599e4a5ce Merge pull request #1528 from rainers/fix_1180