FastLED 3.9.15
Loading...
Searching...
No Matches
fl::SlabAllocator< T, SLAB_SIZE > Class Template Reference

Detailed Description

template<typename T, fl::size SLAB_SIZE = FASTLED_DEFAULT_SLAB_SIZE>
class fl::SlabAllocator< T, SLAB_SIZE >

Definition at line 461 of file allocator.h.

#include <allocator.h>

+ Collaboration diagram for fl::SlabAllocator< T, SLAB_SIZE >:

Classes

struct  Slab
 

Public Member Functions

 SlabAllocator () FL_NOEXCEPT
 
 SlabAllocator (const SlabAllocator &) FL_NOEXCEPT=delete
 
 SlabAllocator (SlabAllocator &&other) FL_NOEXCEPT
 
 ~SlabAllocator () FL_NOEXCEPT
 
T * allocate (fl::size n=1) FL_NOEXCEPT
 
void cleanup () FL_NOEXCEPT
 
void deallocate (T *ptr, fl::size n=1) FL_NOEXCEPT
 
fl::size getActiveAllocations () const FL_NOEXCEPT
 
fl::size getSlabCount () const FL_NOEXCEPT
 
fl::size getTotalAllocated () const FL_NOEXCEPT
 
fl::size getTotalDeallocated () const FL_NOEXCEPT
 
SlabAllocatoroperator= (const SlabAllocator &) FL_NOEXCEPT=delete
 
SlabAllocatoroperator= (SlabAllocator &&other) FL_NOEXCEPT
 

Private Member Functions

void * allocateFromSlab (fl::size n=1) FL_NOEXCEPT
 
SlabcreateSlab () FL_NOEXCEPT
 
void deallocateToSlab (void *ptr, fl::size n=1) FL_NOEXCEPT
 
void * findContiguousBlocks (Slab *slab, fl::size n) FL_NOEXCEPT
 

Private Attributes

SlabmSlabs
 
fl::size mTotalAllocated
 
fl::size mTotalDeallocated
 

Static Private Attributes

static constexpr fl::size BLOCKS_PER_SLAB = SLAB_SIZE
 
static constexpr fl::size SLAB_BLOCK_SIZE = sizeof(T) > sizeof(void*) ? sizeof(T) : sizeof(void*)
 
static constexpr fl::size SLAB_MEMORY_SIZE = SLAB_BLOCK_SIZE * BLOCKS_PER_SLAB
 

The documentation for this class was generated from the following file: