regular free
| 442 | |
| 443 | // regular free |
| 444 | static 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. |
no test coverage detected