Class MmapPool

This allocator allocates memory in regions (multiple of 4 KB for example). Each region is then splitted in blocks. So it doesn't request the memory from the operating system on each call, but only if there are no large enough free blocks in the available regions. Deallocation works in the same way. Deallocation doesn't immediately gives the memory back to the operating system, but marks the appropriate block as free and only if all blocks in the region are free, the complete region is deallocated.

class MmapPool
  : Allocator ;
|      |     |         |     |            ||      |     |                  |
|      |prev <-----------    |            ||      |     |                  |
|  R   |  B  |         |  B  |            ||   R  |  B  |                  |
|  E   |  L  |         |  L  |           next  E  |  L  |                  |
|  G   |  O  |  DATA   |  O  |   FREE    --->  G  |  O  |       DATA       |
|  I   |  C  |         |  C  |           <---  I  |  C  |                  |
|  O   |  K  |         |  K  |           prev  O  |  K  |                  |
|  N   |    -----------> next|            ||   N  |     |                  |
|      |     |         |     |            ||      |     |                  |

Properties

NameTypeDescription
instance[get] MmapPoolStatic allocator instance and initializer.
alignment[get] immutable(uint)

Methods

NameDescription
allocate (size) Allocates size bytes of memory.
deallocate (p) Deallocates a memory block.
reallocate (p, size) Increases or decreases the size of a memory block.
allocate (size) Allocates size bytes of memory.
deallocate (p) Deallocates a memory block.
reallocate (p, size) Increases or decreases the size of a memory block.

TODO