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

Function mi_heap_page_collect

3rd/mimalloc-2.0.9/src/heap.c:88–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86
87
88static bool mi_heap_page_collect(mi_heap_t* heap, mi_page_queue_t* pq, mi_page_t* page, void* arg_collect, void* arg2 ) {
89 MI_UNUSED(arg2);
90 MI_UNUSED(heap);
91 mi_assert_internal(mi_heap_page_is_valid(heap, pq, page, NULL, NULL));
92 mi_collect_t collect = *((mi_collect_t*)arg_collect);
93 _mi_page_free_collect(page, collect >= MI_FORCE);
94 if (mi_page_all_free(page)) {
95 // no more used blocks, free the page.
96 // note: this will free retired pages as well.
97 _mi_page_free(page, pq, collect >= MI_FORCE);
98 }
99 else if (collect == MI_ABANDON) {
100 // still used blocks but the thread is done; abandon the page
101 _mi_page_abandon(page, pq);
102 }
103 return true; // don't break
104}
105
106static bool mi_heap_page_never_delayed_free(mi_heap_t* heap, mi_page_queue_t* pq, mi_page_t* page, void* arg1, void* arg2) {
107 MI_UNUSED(arg1);

Callers

nothing calls this directly

Calls 5

mi_heap_page_is_validFunction · 0.85
_mi_page_free_collectFunction · 0.85
mi_page_all_freeFunction · 0.85
_mi_page_freeFunction · 0.85
_mi_page_abandonFunction · 0.85

Tested by

no test coverage detected