implement arena destroy on program exit

This commit is contained in:
daanx 2023-04-04 18:44:08 -07:00
parent 4c4f2f4084
commit 83aa635485
3 changed files with 82 additions and 22 deletions

View file

@ -158,7 +158,7 @@ static void mi_heap_collect_ex(mi_heap_t* heap, mi_collect_t collect)
// collect regions on program-exit (or shared library unload)
if (collect >= MI_FORCE && _mi_is_main_thread() && mi_heap_is_backing(heap)) {
_mi_arena_collect(false,true,&heap->tld->stats);
_mi_arena_collect(false /* destroy arenas */, true /* force purge */, &heap->tld->stats);
}
}