MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / mi_stat_free

Function mi_stat_free

3rd/mimalloc-2.0.9/src/alloc.c:321–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

319// only maintain stats for smaller objects if requested
320#if (MI_STAT>0)
321static void mi_stat_free(const mi_page_t* page, const mi_block_t* block) {
322 #if (MI_STAT < 2)
323 MI_UNUSED(block);
324 #endif
325 mi_heap_t* const heap = mi_heap_get_default();
326 const size_t bsize = mi_page_usable_block_size(page);
327 #if (MI_STAT>1)
328 const size_t usize = mi_page_usable_size_of(page, block);
329 mi_heap_stat_decrease(heap, malloc, usize);
330 #endif
331 if (bsize <= MI_MEDIUM_OBJ_SIZE_MAX) {
332 mi_heap_stat_decrease(heap, normal, bsize);
333 #if (MI_STAT > 1)
334 mi_heap_stat_decrease(heap, normal_bins[_mi_bin(bsize)], 1);
335 #endif
336 }
337 else if (bsize <= MI_LARGE_OBJ_SIZE_MAX) {
338 mi_heap_stat_decrease(heap, large, bsize);
339 }
340 else {
341 mi_heap_stat_decrease(heap, huge, bsize);
342 }
343}
344#else
345static void mi_stat_free(const mi_page_t* page, const mi_block_t* block) {
346 MI_UNUSED(page); MI_UNUSED(block);

Callers 2

_mi_free_genericFunction · 0.85
mi_freeFunction · 0.85

Calls 4

mi_heap_get_defaultFunction · 0.85
mi_page_usable_size_ofFunction · 0.85
_mi_binFunction · 0.85

Tested by

no test coverage detected