Struct SlabAllocator

Public

A tiny slab allocator.

Allocates spans of type T in power-of-two sized blocks.

Note

This allocator has no support for merging adjacent freed blocks. Therefore it is best suited for similarly sized allocations which are relatively small.

Can be used in burst jobs.

Inner Types

Public Methods

Allocate (values, start, length)

Allocates an array big enough to fit the given values and copies them to the new allocation.

Public
Allocate (values)

Allocates an array big enough to fit the given values and copies them to the new allocation.

Public
Allocate (nElements)

Allocates an array of type T with length nElements.

Public
CheckDisposed ()
Public
Clear ()

Frees all existing allocations.

Public
CopyTo (other)
Public
Dispose ()

Frees all unmanaged memory associated with this container.

Public
Free (allocatedIndex)

Frees a single allocation.

Public
GetSpan (allocatedIndex)

Get the span representing the given allocation.

Public
SlabAllocator (initialCapacityBytes, allocator)
Public

Public Variables

ByteSize
Public
IsCreated
Public
data
Public

Public Static Variables

AllocatedBit
Public Static
LengthMask
Public Static
MaxAllocationSizeLog2
Public Static
UsedBit
Public Static

Private/Protected Members

ElementsToSizeIndex (nElements)
Internal Static