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

@ -592,7 +592,7 @@ static void mi_cdecl mi_process_done(void) {
// or C-runtime termination code.
if (mi_option_is_enabled(mi_option_destroy_on_exit)) {
_mi_heap_destroy_all(); // forcefully release all memory held by all heaps (of this thread only!)
_mi_arena_collect(true,true,&_mi_heap_main_get()->tld->stats);
_mi_arena_collect(true /* destroy (owned) arenas */, true /* purge the rest */, &_mi_heap_main_get()->tld->stats);
}
if (mi_option_is_enabled(mi_option_show_stats) || mi_option_is_enabled(mi_option_verbose)) {