MCPcopy Create free account
hub / github.com/FastLED/FastLED / deallocate

Method deallocate

src/fl/stl/allocator.h:931–955  ·  view source on GitHub ↗

Deallocate memory for n objects of type T

Source from the content-addressed store, hash-verified

929
930 // Deallocate memory for n objects of type T
931 void deallocate(T* p, fl::size n) FL_NOEXCEPT {
932 if (!p || n == 0) {
933 return;
934 }
935
936 // Check if this is inlined memory
937 T* inlined_start = get_inlined_ptr();
938 T* inlined_end = inlined_start + N;
939
940 if (p >= inlined_start && p < inlined_end) {
941 // This is inlined memory, mark slots as free
942 fl::size slot_index = (p - inlined_start);
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 }
948 mActiveAllocations -= n;
949 return;
950 }
951
952 // Fallback to base allocator for heap allocations
953 mBaseAllocator.deallocate(p, n);
954 mActiveAllocations -= n;
955 }
956
957 // Construct an object at the specified address
958 template <typename U, typename... Args>

Callers

nothing calls this directly

Calls 2

setMethod · 0.45
deallocateMethod · 0.45

Tested by

no test coverage detected