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

Function _mi_page_free_collect

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

Source from the content-addressed store, hash-verified

204}
205
206void _mi_page_free_collect(mi_page_t* page, bool force) {
207 mi_assert_internal(page!=NULL);
208
209 // collect the thread free list
210 if (force || mi_page_thread_free(page) != NULL) { // quick test to avoid an atomic operation
211 _mi_page_thread_free_collect(page);
212 }
213
214 // and the local free list
215 if (page->local_free != NULL) {
216 if mi_likely(page->free == NULL) {
217 // usual case
218 page->free = page->local_free;
219 page->local_free = NULL;
220 page->is_zero = false;
221 }
222 else if (force) {
223 // append -- only on shutdown (force) as this is a linear operation
224 mi_block_t* tail = page->local_free;
225 mi_block_t* next;
226 while ((next = mi_block_next(page, tail)) != NULL) {
227 tail = next;
228 }
229 mi_block_set_next(page, tail, page->free);
230 page->free = page->local_free;
231 page->local_free = NULL;
232 page->is_zero = false;
233 }
234 }
235
236 mi_assert_internal(!force || page->local_free == NULL);
237}
238
239
240

Callers 9

_mi_free_delayed_blockFunction · 0.85
mi_segment_check_freeFunction · 0.85
mi_segment_reclaimFunction · 0.85
mi_heap_page_collectFunction · 0.85
_mi_heap_page_destroyFunction · 0.85
mi_page_to_fullFunction · 0.85
mi_find_free_pageFunction · 0.85

Calls 2

mi_page_thread_freeFunction · 0.85

Tested by

no test coverage detected