diff options
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -5033,9 +5033,19 @@ vm_malloc_increase(rb_objspace_t *objspace, size_t new_size, size_t old_size, in } if (do_gc) { - if ((ruby_gc_stress && !ruby_disable_gc_stress) || (malloc_increase > malloc_limit)) { + if (ruby_gc_stress && !ruby_disable_gc_stress) { garbage_collect_with_gvl(objspace, 0, 0, GPR_FLAG_MALLOC); } + else { + retry: + if (malloc_increase > malloc_limit) { + if (is_lazy_sweeping(heap_eden)) { + gc_rest_sweep(objspace); /* rest_sweep can reduce malloc_increase */ + goto retry; + } + garbage_collect_with_gvl(objspace, 0, 0, GPR_FLAG_MALLOC); + } + } } } |