View source code
Display the source code in std/experimental/allocator/showcase.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.

Function std.experimental.allocator.showcase.mmapRegionList

Creates a scalable AllocatorList of Regions, each having at least bytesPerRegion bytes. Allocation is very fast. This allocator does not offer deallocate but does free all regions in its destructor. It is recommended for short-lived batch applications that count on never running out of memory.

AllocatorList!(std.experimental.allocator.showcase.mmapRegionList(ulong).Factory,std.experimental.allocator.building_blocks.null_allocator.NullAllocator) mmapRegionList (
  ulong bytesPerRegion


auto alloc = mmapRegionList(1024 * 1024);
const b = alloc.allocate(100);
writeln(b.length); // 100