FastLED 3.9.15
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 931 of file allocator.h.

931 {
932 if (!p || n == 0) {
933 return;
934 }
935
936 // Check if this is inlined memory
939
940 if (p >= inlined_start && p < inlined_end) {
941 // This is inlined memory, mark slots as free
943 for (fl::size i = 0; i < n; ++i) {
944 if (slot_index + i < N) {
945 mFreeBits.set(slot_index + i, false); // Mark as free
946 }
947 }
949 return;
950 }
951
952 // Fallback to base allocator for heap allocations
953 mBaseAllocator.deallocate(p, n);
955 }
BaseAllocator mBaseAllocator
Definition allocator.h:818
fl::size mActiveAllocations
Definition allocator.h:821
T * get_inlined_ptr() FL_NOEXCEPT
Definition allocator.h:1001
fl::bitset_fixed< N > mFreeBits
Definition allocator.h:820