Bug 17564 – std.experimental.allocator.theAllocator is null within shared static this
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-06-28T12:44:04Z
Last change time
2018-01-05T13:29:39Z
Assigned to
No Owner
Creator
Sönke Ludwig
Comments
Comment #0 by sludwig — 2017-06-28T12:44:04Z
vibe.d needs to use "shared static this" for initialization to support the original initialization scheme for applications that it still in wide use. With 2.075.0-b1, since processAllocator now returns an ISharedAllocator, it had to switch to theAllocator where possible. However, since this returns null during the "shared static this" phase, this causes a crash on startup. Setting theAllocator to something else also doesn't work, because of an assertion in std.experimental.allocator.
Proposed change is to make initialization lazy, just as for processAllocator.
Comment #1 by github-bugzilla — 2017-06-29T13:23:12Z