View source code
Display the source code in std/experimental/allocator/building_blocks/kernighan_ritchie.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.
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.
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.
.experimental .allocator .gc_allocator : GCAllocator; auto alloc = KRRegion!GCAllocator(1024 * 64); const b1 = alloc .allocate(2048); writeln(b1 .length); // 2048 const b2 = alloc .allocateAll; writeln(b2 .length); // 1024 * 62
Copyright © 1999-2023 by the D Language Foundation | Page generated by ddox.