From e6ab602ca1486424868b23f3f889c3f9e37b19ef Mon Sep 17 00:00:00 2001 From: Daan Leijen Date: Mon, 21 Nov 2022 10:24:02 -0800 Subject: [PATCH] add comment --- src/init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/init.c b/src/init.c index 750693c0..3f71fa01 100644 --- a/src/init.c +++ b/src/init.c @@ -608,6 +608,9 @@ static void mi_cdecl mi_process_done(void) { #endif #endif + // Forcefully release all retained memory; this can be dangerous in general if overriding regular malloc/free + // since after process_done there might still be other code running that calls `free` (like at_exit routines, + // 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_mem_collect(&_mi_heap_main_get()->tld->os); // release all regions