Bug 18937 – [REG 2.080.0] std.experimental.allocator: compiling `make` needs an unreasonable amount of memory for structs that contain static arrays

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-06-03T13:30:01Z
Last change time
2018-06-30T20:08:21Z
Assigned to
No Owner
Creator
ag0aep6g

Comments

Comment #0 by ag0aep6g — 2018-06-03T13:30:01Z
test.d: ---- import std.experimental.allocator: make; @safe unittest { static struct S { version (small) ubyte[1024] data; else version (large) ubyte[4 * 1024] data; else version (vlarg) ubyte[16 * 1024] data; else static assert(false); } static struct SomeAllocator { ubyte[] allocate(size_t) { return []; } void deallocate(void[]) {} } auto x = SomeAllocator().make!S(); } ---- With 2.079.1, all three versions compile quickly, and DMD needs about 40 MiB of memory for all of them. With 2.080.0, compilation needs an unreasonable amount of time and memory. The vlarg version exceeds 4 GiB and 1 minute. `for dmd in dmd2.079 dmd2.080; do for v in -version=small -version=large -version=vlarg; do /usr/bin/time -f "$dmd $v: time: %E, memory: %M KiB" $dmd -c -unittest $v test.d; done; done`: ---- dmd2.079 -version=small: time: 0:00.12, memory: 40272 KiB dmd2.079 -version=large: time: 0:00.11, memory: 40368 KiB dmd2.079 -version=vlarg: time: 0:00.12, memory: 40920 KiB dmd2.080 -version=small: time: 0:00.43, memory: 133276 KiB dmd2.080 -version=large: time: 0:04.52, memory: 1342532 KiB Error: out of memory Command exited with non-zero status 1 dmd2.080 -version=vlarg: time: 1:29.09, memory: 3713344 KiB ---- The culprit seems to be std.experimental.allocator.common.isAllZeroBits. I'm looking into fixing this there.
Comment #1 by ag0aep6g — 2018-06-03T14:00:04Z
(In reply to ag0aep6g from comment #0) > I'm looking into fixing this there. Pull request: https://github.com/dlang/phobos/pull/6537
Comment #2 by github-bugzilla — 2018-06-30T20:08:15Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/86af9e6bcefd604f5b435b531e56a02bb4ecee7a fix issue 18937 - [REG 2.080.0] std.experimental.allocator: compiling `make` needs an unreasonable amount of memory for structs that contain static arrays https://github.com/dlang/phobos/commit/75feb5726aceb5101823b79d9df7f0a89072b547 Merge pull request #6537 from aG0aep6G/18937 fix issue 18937 - [REG 2.080.0] std.experimental.allocator: compiling…