template <typename T, size_t SLAB_SIZE, typename LockType, SlabAllocatorFlavor AllocatorFlavor, SlabAllocatorOptions Options>

struct SlabAllocatorTraits

Defined at line 710 of file ../../zircon/system/ulib/fbl/include/fbl/slab_allocator.h

/////////////////////////////////////////////////////////////////////////////

Fundamental traits which control the properties of a slab allocator.

Parameters:

++ T

The pointer type of the object to be created by the allocator. Must be one

of the following...

++ ObjectType*

++ std::unique_ptr

<ObjectType

>

++ fbl::RefPtr

<ObjectType

>

++ SLAB_SIZE

The size (in bytes) of an individual slab. Defaults to 16KB

++ LockType

The fbl::AutoLock compatible class which will handle synchronization.

++ AllocatorType

Selects between a the three flavors of allocator.

++ INSTANCED - Allocations come from an instance of an allocator.

Allocation objects carry the overhead of an "origin pointer" which will

be used to find their way home when the delete operator is applied to the

object. Each instance of an allocator has it's own slab quota.

++ STATIC - Allocations come from a static instance of an allocator. There

is only one allocation pool for the entire process. All allocator

methods are static members of the allocator's type and use the

MyAllocator::Method syntax (instead of my_allocator.Method). Allocation

objects carry no overhead and will find their way home based on type when

the delete operator is applied to them.

++ MANUAL_DELETE - A type of INSTANCED allocator where objects have no

pointer overhead. The delete operator of the object is hidden in the

SlabAllocated

<

> class preventing users from delete'ing these objects, and

will also trigger a static_assert if invoked. Users must be aware of

where their allocations came from and are responsible for calling

allocator.Delete in order to destruct and return the object to the

allocator it came from.

/////////////////////////////////////////////////////////////////////////////

Public Members

static const size_t SLAB_SIZE
static SlabAllocatorFlavor AllocatorFlavor
static SlabAllocatorOptions Options