KRRegion.allocateAll

Allocates all memory available to this allocator. If the allocator is empty, returns the entire available block of memory. Otherwise, it still performs a best-effort allocation: if there is no fragmentation (e.g. allocate has been used but not deallocate), allocates and returns the only available block of memory.

The operation takes time proportional to the number of adjacent free blocks at the front of the free list. These blocks get coalesced, whether allocateAll succeeds or fails due to fragmentation.

struct KRRegion(ParentAllocator = NullAllocator)
void[]
allocateAll
()

Examples

import stdx.allocator.gc_allocator : GCAllocator;
auto alloc = KRRegion!GCAllocator(1024 * 64);
const b1 = alloc.allocate(2048);
assert(b1.length == 2048);
const b2 = alloc.allocateAll;
assert(b2.length == 1024 * 62);

Meta