mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user