FastLED 3.10.6
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 563 of file allocator.h.

563 {
564 if (!ptr) {
565 return;
566 }
567
568 // Find which slab this block belongs to
569 for (Slab* slab = mSlabs; slab; slab = slab->next) {
570 u8* slab_start = slab->memory;
573
576
577 // Mark blocks as free in the bitset
578 for (fl::size i = 0; i < n; ++i) {
579 if (block_index + i < BLOCKS_PER_SLAB) {
580 slab->allocated_blocks.set(block_index + i, false);
581 }
582 }
583
584 slab->allocated_count -= n;
586 break;
587 }
588 }
589 }
static constexpr fl::size BLOCKS_PER_SLAB
Definition allocator.h:466
fl::size mTotalDeallocated
Definition allocator.h:489
static constexpr fl::size SLAB_MEMORY_SIZE
Definition allocator.h:467
static constexpr fl::size SLAB_BLOCK_SIZE
Definition allocator.h:465
To * bit_cast_ptr(void *storage) FL_NO_EXCEPT
Definition bit_cast.h:60

References fl::bit_cast_ptr(), BLOCKS_PER_SLAB, fl::FL_NO_EXCEPT, 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: