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

Function _mi_page_free

3rd/mimalloc-2.0.9/src/page.c:396–416  ·  view source on GitHub ↗

Free a page with no more free blocks

Source from the content-addressed store, hash-verified

394
395// Free a page with no more free blocks
396void _mi_page_free(mi_page_t* page, mi_page_queue_t* pq, bool force) {
397 mi_assert_internal(page != NULL);
398 mi_assert_expensive(_mi_page_is_valid(page));
399 mi_assert_internal(pq == mi_page_queue_of(page));
400 mi_assert_internal(mi_page_all_free(page));
401 mi_assert_internal(mi_page_thread_free_flag(page)!=MI_DELAYED_FREEING);
402
403 // no more aligned blocks in here
404 mi_page_set_has_aligned(page, false);
405
406 mi_heap_t* heap = mi_page_heap(page);
407
408 // remove from the page list
409 // (no need to do _mi_heap_delayed_free first as all blocks are already free)
410 mi_segments_tld_t* segments_tld = &heap->tld->segments;
411 mi_page_queue_remove(pq, page);
412
413 // and free it
414 mi_page_set_heap(page,NULL);
415 _mi_segment_page_free(page, force, segments_tld);
416}
417
418// Retire parameters
419#define MI_MAX_RETIRE_SIZE (MI_MEDIUM_OBJ_SIZE_MAX)

Callers 3

mi_heap_page_collectFunction · 0.85
_mi_page_retireFunction · 0.85
_mi_heap_collect_retiredFunction · 0.85

Calls 9

_mi_page_is_validFunction · 0.85
mi_page_queue_ofFunction · 0.85
mi_page_all_freeFunction · 0.85
mi_page_thread_free_flagFunction · 0.85
mi_page_set_has_alignedFunction · 0.85
mi_page_heapFunction · 0.85
mi_page_queue_removeFunction · 0.85
mi_page_set_heapFunction · 0.85
_mi_segment_page_freeFunction · 0.85

Tested by

no test coverage detected