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 183 of file allocator.h.

#include <allocator.h>

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

Classes

struct  Slab
 

Public Member Functions

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

Private Member Functions

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

Private Attributes

Slabslabs_
 
fl::size total_allocated_
 
fl::size total_deallocated_
 

Static Private Attributes

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

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