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

Function _mi_free_block

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

regular free

Source from the content-addressed store, hash-verified

442
443// regular free
444static inline void _mi_free_block(mi_page_t* page, bool local, mi_block_t* block)
445{
446 // and push it on the free list
447 //const size_t bsize = mi_page_block_size(page);
448 if mi_likely(local) {
449 // owning thread can free a block directly
450 if mi_unlikely(mi_check_is_double_free(page, block)) return;
451 mi_check_padding(page, block);
452 #if (MI_DEBUG!=0) && !MI_TRACK_ENABLED
453 if (!mi_page_is_huge(page)) { // huge page content may be already decommitted
454 memset(block, MI_DEBUG_FREED, mi_page_block_size(page));
455 }
456 #endif
457 mi_block_set_next(page, block, page->local_free);
458 page->local_free = block;
459 page->used--;
460 if mi_unlikely(mi_page_all_free(page)) {
461 _mi_page_retire(page);
462 }
463 else if mi_unlikely(mi_page_is_in_full(page)) {
464 _mi_page_unfull(page);
465 }
466 }
467 else {
468 _mi_free_block_mt(page,block);
469 }
470}
471
472
473// Adjust a block that was allocated aligned, to the actual start of the block in the page.

Callers 2

_mi_free_genericFunction · 0.85
_mi_free_delayed_blockFunction · 0.85

Calls 6

mi_check_paddingFunction · 0.85
mi_page_is_hugeFunction · 0.85
mi_page_block_sizeFunction · 0.85
mi_block_set_nextFunction · 0.85
_mi_page_retireFunction · 0.85
_mi_free_block_mtFunction · 0.85

Tested by

no test coverage detected