Bug 18853 – std.allocator: AllocatorList fails to allocate after a deallocation

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-05-11T06:08:53Z
Last change time
2018-05-16T00:44:22Z
Assigned to
alex.jercaianu
Creator
Vladimir Panteleev

Comments

Comment #0 by dlang-bugzilla — 2018-05-11T06:08:53Z
///////////////////////////// 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.
Comment #1 by dlang-bugzilla — 2018-05-16T00:44:22Z