nicer logic in free

This commit is contained in:
Daan Leijen 2025-01-03 14:26:32 -08:00
parent f6c2550eac
commit 6099f76c8c

View file

@ -176,9 +176,8 @@ void mi_free(void* p) mi_attr_noexcept
// page is local, but is full or contains (inner) aligned blocks; use generic path // page is local, but is full or contains (inner) aligned blocks; use generic path
mi_free_generic_local(page, p); mi_free_generic_local(page, p);
} }
else {
// free-ing in a page owned by a heap in another thread, or on abandoned page (not belonging to a heap) // free-ing in a page owned by a heap in another thread, or on abandoned page (not belonging to a heap)
if ((xtid & MI_PAGE_FLAG_MASK) == 0) { // `tid!=mi_page_thread_id(page) && mi_page_flags(page)==0` else if ((xtid & MI_PAGE_FLAG_MASK) == 0) { // `tid!=mi_page_thread_id(page) && mi_page_flags(page)==0`
// blocks are aligned (and not a full page) // blocks are aligned (and not a full page)
mi_block_t* const block = (mi_block_t*)p; mi_block_t* const block = (mi_block_t*)p;
mi_free_block_mt(page,block); mi_free_block_mt(page,block);
@ -188,7 +187,6 @@ void mi_free(void* p) mi_attr_noexcept
mi_free_generic_mt(page, p); mi_free_generic_mt(page, p);
} }
} }
}
// ------------------------------------------------------ // ------------------------------------------------------