[Issue 18760] New: theAllocator should hold a reference to the allocator that it uses
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Apr 13 15:07:33 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18760
Issue ID: 18760
Summary: theAllocator should hold a reference to the allocator
that it uses
Product: D
Version: D2
Hardware: x86_64
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: edi33416 at gmail.com
Currently, theAllocator does not hold a reference to the underlying process
allocator that does the work. Otherwise, changing the processAllocator will
result in segfault/UB on behalf of theAllocator.
The following snippet better describes the issue, causing a segfault
```
import std.experimental.allocator.mallocator : Mallocator;
auto a = sharedAllocatorObject(Mallocator.instance);
auto buf = theAllocator.allocate(42);
processAllocator = a;
theAllocator.deallocate(buf);
```
--
More information about the Digitalmars-d-bugs
mailing list