[Issue 18853] New: std.allocator: AllocatorList fails to allocate after a deallocation
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri May 11 06:08:53 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18853
Issue ID: 18853
Summary: std.allocator: AllocatorList fails to allocate after a
deallocation
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: edi33416 at gmail.com
Reporter: dlang-bugzilla at thecybershadow.net
CC: andrei at erdani.com
///////////////////////////// test.d ////////////////////////////
import std.algorithm.comparison;
import std.experimental.allocator;
import std.experimental.allocator.building_blocks.allocator_list;
import std.experimental.allocator.building_blocks.region;
import std.experimental.allocator.gc_allocator;
void main()
{
AllocatorList!((n) => Region!GCAllocator(max(n, 4096)),
GCAllocator) allocator;
auto buf = allocator.allocate(2048);
allocator.deallocate(buf);
buf = allocator.allocate(4097);
assert(buf.length);
}
/////////////////////////////////////////////////////////////////
At a glance, looks like it's caused by the thrashing protection not taking
deallocations into account.
--
More information about the Digitalmars-d-bugs
mailing list