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

284 {
285 if (!ptr) {
286 return;
287 }
288
289 // Find which slab this block belongs to
290 for (Slab* slab = slabs_; slab; slab = slab->next) {
291 u8* slab_start = slab->memory;
294
297
298 // Mark blocks as free in the bitset
299 for (fl::size i = 0; i < n; ++i) {
300 if (block_index + i < BLOCKS_PER_SLAB) {
301 slab->allocated_blocks.set(block_index + i, false);
302 }
303 }
304
305 slab->allocated_count -= n;
307 break;
308 }
309 }
310 }
static constexpr fl::size BLOCK_SIZE
Definition allocator.h:187
static constexpr fl::size BLOCKS_PER_SLAB
Definition allocator.h:188
static constexpr fl::size SLAB_MEMORY_SIZE
Definition allocator.h:189
fl::size total_deallocated_
Definition allocator.h:208
To * bit_cast_ptr(void *storage) noexcept
Definition bit_cast.h:54

References fl::bit_cast_ptr(), BLOCK_SIZE, BLOCKS_PER_SLAB, SLAB_MEMORY_SIZE, slabs_, and total_deallocated_.

Referenced by deallocate().

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