From ab202fbe7399d5851c6913fc11626b234020b551 Mon Sep 17 00:00:00 2001 From: daan Date: Fri, 6 Mar 2020 15:53:07 -0800 Subject: [PATCH] never free the main heap structures; issues #207 --- src/init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/init.c b/src/init.c index 2c9dec1a..0fd5454c 100644 --- a/src/init.c +++ b/src/init.c @@ -241,7 +241,9 @@ static bool _mi_heap_done(mi_heap_t* heap) { mi_assert_internal(heap->tld->segments.count == 0); _mi_os_free(heap, sizeof(mi_thread_data_t), &_mi_stats_main); } -#if (MI_DEBUG > 0) +#if 0 + // never free the main thread even in debug mode; if a dll is linked statically with mimalloc, + // there may still be delete/free calls after the mi_fls_done is called. Issue #207 else { _mi_heap_destroy_pages(heap); mi_assert_internal(heap->tld->heap_backing == &_mi_heap_main);