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

Function mi_heap_delete

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

Safe delete a heap without freeing any still allocated blocks in that heap.

Source from the content-addressed store, hash-verified

402
403// Safe delete a heap without freeing any still allocated blocks in that heap.
404void mi_heap_delete(mi_heap_t* heap)
405{
406 mi_assert(heap != NULL);
407 mi_assert(mi_heap_is_initialized(heap));
408 mi_assert_expensive(mi_heap_is_valid(heap));
409 if (heap==NULL || !mi_heap_is_initialized(heap)) return;
410
411 if (!mi_heap_is_backing(heap)) {
412 // tranfer still used pages to the backing heap
413 mi_heap_absorb(heap->tld->heap_backing, heap);
414 }
415 else {
416 // the backing heap abandons its pages
417 _mi_heap_collect_abandon(heap);
418 }
419 mi_assert_internal(heap->page_count==0);
420 mi_heap_free(heap);
421}
422
423mi_heap_t* mi_heap_set_default(mi_heap_t* heap) {
424 mi_assert(heap != NULL);

Callers 5

t1mainFunction · 0.85
test_heap2Function · 0.85
_mi_heap_doneFunction · 0.85
mi_heap_destroyFunction · 0.85
heap_deleteMethod · 0.85

Calls 6

mi_heap_is_initializedFunction · 0.85
mi_heap_is_validFunction · 0.85
mi_heap_is_backingFunction · 0.85
mi_heap_absorbFunction · 0.85
_mi_heap_collect_abandonFunction · 0.85
mi_heap_freeFunction · 0.85

Tested by 2

t1mainFunction · 0.68
test_heap2Function · 0.68