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

Function mi_heap_reset_pages

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

zero out the page queues

Source from the content-addressed store, hash-verified

233
234// zero out the page queues
235static void mi_heap_reset_pages(mi_heap_t* heap) {
236 mi_assert_internal(heap != NULL);
237 mi_assert_internal(mi_heap_is_initialized(heap));
238 // TODO: copy full empty heap instead?
239 memset(&heap->pages_free_direct, 0, sizeof(heap->pages_free_direct));
240#ifdef MI_MEDIUM_DIRECT
241 memset(&heap->pages_free_medium, 0, sizeof(heap->pages_free_medium));
242#endif
243 _mi_memcpy_aligned(&heap->pages, &_mi_heap_empty.pages, sizeof(heap->pages));
244 heap->thread_delayed_free = NULL;
245 heap->page_count = 0;
246}
247
248// called from `mi_heap_destroy` and `mi_heap_delete` to free the internal heap resources.
249static void mi_heap_free(mi_heap_t* heap) {

Callers 2

_mi_heap_destroy_pagesFunction · 0.85
mi_heap_absorbFunction · 0.85

Calls 2

mi_heap_is_initializedFunction · 0.85
_mi_memcpy_alignedFunction · 0.85

Tested by

no test coverage detected