FastLED 3.10.6
Loading...
Searching...
No Matches

◆ deallocate()

template<typename T, fl::size N, typename BaseAllocator = fl::allocator<T>>
void fl::allocator_inlined< T, N, BaseAllocator >::deallocate ( T * p,
fl::size n )
inline

Definition at line 945 of file allocator.h.

945 {
946 if (!p || n == 0) {
947 return;
948 }
949
950 // Check if this is inlined memory
953
954 if (p >= inlined_start && p < inlined_end) {
955 // This is inlined memory, mark slots as free
957 for (fl::size i = 0; i < n; ++i) {
958 if (slot_index + i < N) {
959 mFreeBits.set(slot_index + i, false); // Mark as free
960 }
961 }
963 return;
964 }
965
966 // Fallback to base allocator for heap allocations
967 mBaseAllocator.deallocate(p, n);
969 }
BaseAllocator mBaseAllocator
Definition allocator.h:832
fl::size mActiveAllocations
Definition allocator.h:835
T * get_inlined_ptr() FL_NO_EXCEPT
Definition allocator.h:1015
fl::bitset_fixed< N > mFreeBits
Definition allocator.h:834