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

Method on_free

tests/profile/json_memory_profile.cpp:79–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77 }
78
79 void on_free(void* ptr) {
80 if (!ptr) return;
81
82 auto it = allocations.find(ptr);
83 if (it != allocations.end()) {
84 size_t size = it->second;
85 current_bytes.fetch_sub(size);
86 free_count.fetch_add(1);
87 // unsorted_map_fixed has erase(), so we could remove the entry, but for simplicity
88 // we just mark it as removed by setting size to 0. current_bytes tracking is separate.
89 allocations[ptr] = 0;
90 }
91 }
92
93 size_t count_active_allocations() const {
94 size_t count = 0;

Callers 2

reallocFunction · 0.80
freeFunction · 0.80

Calls 4

findMethod · 0.45
endMethod · 0.45
fetch_subMethod · 0.45
fetch_addMethod · 0.45

Tested by

no test coverage detected