use subproc_main for final statistics output to avoid dereferencing the heap

This commit is contained in:
daanx 2025-06-06 14:38:20 -07:00
parent 7c7ecf096f
commit 08b64e71a7
4 changed files with 7 additions and 4 deletions

View file

@ -784,7 +784,7 @@ void mi_cdecl _mi_process_done(void) {
//_mi_page_map_unsafe_destroy(_mi_subproc_main());
if (mi_option_is_enabled(mi_option_show_stats) || mi_option_is_enabled(mi_option_verbose)) {
mi_stats_print(NULL);
_mi_stats_print(&_mi_subproc_main()->stats, NULL, NULL); // use always main subproc at process exit to avoid dereferencing the heap (as it may be destroyed by now)
}
_mi_allocator_done();
_mi_verbose_message("process done: 0x%zx\n", tld_main.thread_id);