Avoid a full GC when growing finalizer tables if in incremental mode
authorJonas Echterhoff <jonas@unity3d.com>
Thu, 21 Feb 2019 10:49:16 +0000 (11:49 +0100)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 22 Feb 2019 07:15:33 +0000 (10:15 +0300)
Issue Unity-Technologies#37 (bdwgc).

* finalize.c (GC_grow_table): Do not call GC_try_to_collect_inner
if GC_incremental; add comment.

finalize.c

index 978639e..d01c2aa 100644 (file)
@@ -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);