experimental destroy_on_exit option for statically linked mimalloc in a dynamically unloaded DLL

This commit is contained in:
Daan Leijen 2022-11-18 11:00:23 -08:00
parent 18cf94dff6
commit 35d332141d
6 changed files with 25 additions and 4 deletions

View file

@ -327,7 +327,20 @@ void mi_heap_destroy(mi_heap_t* heap) {
}
}
void _mi_heap_destroy_all(void) {
mi_heap_t* bheap = mi_heap_get_backing();
mi_heap_t* curr = bheap->tld->heaps;
while (curr != NULL) {
mi_heap_t* next = curr->next;
if (curr->no_reclaim) {
mi_heap_destroy(curr);
}
else {
_mi_heap_destroy_pages(curr);
}
curr = next;
}
}
/* -----------------------------------------------------------
Safe Heap delete