From: Ivan Maidanski Date: Fri, 20 Jul 2012 07:10:10 +0000 (+0400) Subject: Disable find-leak GC_gcollect on GC abnormal EXIT X-Git-Tag: gc7_4_0~256 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2a95ef5b2bb925c3f1c9faab312c61b3b57480e6;p=gc Disable find-leak GC_gcollect on GC abnormal EXIT * misc.c (GC_exit_check): Test GC_find_leak, if it is switched off then do not invoke GC_gcollect. * misc.c (GC_default_on_abort): Explicitly turn off GC_find_leak to prevent redundant garbage collection on EXIT (caused by some GC failure). --- diff --git a/misc.c b/misc.c index 94f90560..5ef96c4f 100644 --- a/misc.c +++ b/misc.c @@ -644,7 +644,9 @@ GC_INNER GC_bool GC_is_initialized = FALSE; STATIC void GC_exit_check(void) { - GC_gcollect(); + if (GC_find_leak) { + GC_gcollect(); + } } #if defined(UNIX_LIKE) && !defined(NO_DEBUGGING) @@ -1460,6 +1462,8 @@ GC_API GC_warn_proc GC_CALL GC_get_warn_proc(void) /* and from EXIT() macro (msg is NULL in that case). */ STATIC void GC_CALLBACK GC_default_on_abort(const char *msg) { + GC_find_leak = FALSE; /* disable at-exit GC_gcollect() */ + if (msg != NULL) { # if defined(MSWIN32) # ifndef DONT_USE_USER32_DLL