FastLED 3.9.15
Loading...
Searching...
No Matches

◆ deallocateToSlab()

template<typename T, fl::size SLAB_SIZE = FASTLED_DEFAULT_SLAB_SIZE>
void fl::SlabAllocator< T, SLAB_SIZE >::deallocateToSlab ( void * ptr,
fl::size n = 1 )
inlineprivate

Definition at line 559 of file allocator.h.

559 {
560 if (!ptr) {
561 return;
562 }
563
564 // Find which slab this block belongs to
565 for (Slab* slab = mSlabs; slab; slab = slab->next) {
566 u8* slab_start = slab->memory;
569
572
573 // Mark blocks as free in the bitset
574 for (fl::size i = 0; i < n; ++i) {
575 if (block_index + i < BLOCKS_PER_SLAB) {
576 slab->allocated_blocks.set(block_index + i, false);
577 }
578 }
579
580 slab->allocated_count -= n;
582 break;
583 }
584 }
585 }
static constexpr fl::size BLOCKS_PER_SLAB
Definition allocator.h:465
fl::size mTotalDeallocated
Definition allocator.h:485
static constexpr fl::size SLAB_MEMORY_SIZE
Definition allocator.h:466
static constexpr fl::size SLAB_BLOCK_SIZE
Definition allocator.h:464
To * bit_cast_ptr(void *storage) FL_NOEXCEPT
Definition bit_cast.h:60

References fl::bit_cast_ptr(), BLOCKS_PER_SLAB, FL_NOEXCEPT, mSlabs, mTotalDeallocated, SLAB_BLOCK_SIZE, and SLAB_MEMORY_SIZE.

Referenced by deallocate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: