diff options
| -rw-r--r-- | gc/default/default.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gc/default/default.c b/gc/default/default.c index 5f008b44a1..7bad68f902 100644 --- a/gc/default/default.c +++ b/gc/default/default.c @@ -3870,7 +3870,8 @@ gc_sweep_finish_heap(rb_objspace_t *objspace, rb_heap_t *heap) heap_allocatable_bytes_expand(objspace, heap, swept_slots, heap->total_slots, heap->slot_size); } } - else if (objspace->heap_pages.allocatable_bytes < (min_free_slots - swept_slots) * heap->slot_size) { + else if (swept_slots < min_free_slots * 7 / 8 && + objspace->heap_pages.allocatable_bytes < (min_free_slots * 7 / 8 - swept_slots) * heap->slot_size) { gc_needs_major_flags |= GPR_FLAG_MAJOR_BY_NOFREE; heap->force_major_gc_count++; } @@ -5500,7 +5501,7 @@ gc_marks_finish(rb_objspace_t *objspace) } if (objspace->heap_pages.allocatable_bytes == 0 && sweep_slots < min_free_slots) { - if (!full_marking) { + if (!full_marking && sweep_slots < min_free_slots * 7 / 8) { if (objspace->profile.count - objspace->rgengc.last_major_gc < RVALUE_OLD_AGE) { full_marking = TRUE; } |
