View source code
Display the source code in std/experimental/allocator/building_blocks/bitmapped_block.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.building_blocks.bitmapped_block.BitmappedBlock.allocate

Allocates s bytes of memory and returns it, or null if memory could not be allocated.

void[] allocate (
  const size_t s
) pure nothrow @nogc @trusted;

The following information might be of help with choosing the appropriate block size. Actual allocation occurs in sizes multiple of the block size. Allocating one block is the fastest because only one 0 bit needs to be found in the metadata. Allocating 2 through 64 blocks is the next cheapest because it affects a maximum of two ulong in the metadata. Allocations greater than 64 blocks require a multiword search through the metadata.

If instantiated with No.multiblock, it performs a search for the first zero bit in the bitmap and sets it.

Authors

License