Don't mrb_realloc_simple() call mrb_full_gc() in the sweep phase

`mrb_env_unshare()` calls `mrb_realloc_simple()` and follows `mrb_full_gc()` to avoid an infinite loop where `mrb_env_unshare()` is called again.
This does not occur at this time, but may occur in subsequent patches.
This commit is contained in:
dearblue
2024-04-23 22:25:54 +09:00
parent 85120d524a
commit c8c7d1ab23
+4 -2
View File
@@ -190,10 +190,12 @@ mrb_realloc_simple(mrb_state *mrb, void *p, size_t len)
void *p2;
#if defined(MRB_GC_STRESS) && defined(MRB_DEBUG)
mrb_full_gc(mrb);
if (mrb->gc.state != MRB_GC_STATE_SWEEP) {
mrb_full_gc(mrb);
}
#endif
p2 = (mrb->allocf)(mrb, p, len, mrb->allocf_ud);
if (!p2 && len > 0 && mrb->gc.heaps) {
if (!p2 && len > 0 && mrb->gc.heaps && mrb->gc.state != MRB_GC_STATE_SWEEP) {
mrb_full_gc(mrb);
p2 = (mrb->allocf)(mrb, p, len, mrb->allocf_ud);
}