From: Jonas Echterhoff Date: Thu, 21 Feb 2019 10:49:16 +0000 (+0100) Subject: Avoid a full GC when growing finalizer tables if in incremental mode X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6e0590ef188615131d6f4c1f445ce080d9823f54;p=gc Avoid a full GC when growing finalizer tables if in incremental mode Issue Unity-Technologies#37 (bdwgc). * finalize.c (GC_grow_table): Do not call GC_try_to_collect_inner if GC_incremental; add comment. --- diff --git a/finalize.c b/finalize.c index 978639ee..d01c2aa8 100644 --- a/finalize.c +++ b/finalize.c @@ -124,7 +124,9 @@ STATIC void GC_grow_table(struct hash_chain_entry ***table, GC_ASSERT(I_HOLD_LOCK()); /* Avoid growing the table in case of at least 25% of entries can */ /* be deleted by enforcing a collection. Ignored for small tables. */ - if (log_old_size >= GC_ON_GROW_LOG_SIZE_MIN) { + /* In incremental mode we skip this optimization, as we want to */ + /* avoid triggering a full GC whenever possible. */ + if (log_old_size >= GC_ON_GROW_LOG_SIZE_MIN && !GC_incremental) { IF_CANCEL(int cancel_state;) DISABLE_CANCEL(cancel_state);