fix GC bug

GC during allocation of a pair, weak box, ephemeron, or
weak array went wrong if the GC-notification callback
allocated any of those kinds of things.

(Bug found by running tests in GC-stress mode.)
This commit is contained in:
Matthew Flatt 2013-07-04 09:41:30 -06:00
parent e320437403
commit 49fbca5b18

View File

@ -4820,10 +4820,23 @@ static void garbage_collect(NewGC *gc, int force_full, int switching_master, Log
is_master = (gc == MASTERGC);
#endif
gc->dumping_avoid_collection++;
/* Inform might allocate, which might need park: */
gc->park_save[0] = gc->park[0];
gc->park_save[1] = gc->park[1];
gc->park[0] = NULL;
gc->park[1] = NULL;
gc->GC_collect_inform_callback(is_master, gc->gc_full,
old_mem_use + old_gen0, gc->memory_in_use,
old_mem_allocated, mmu_memory_allocated(gc->mmu),
gc->child_gc_total);
gc->park[0] = gc->park_save[0];
gc->park[1] = gc->park_save[1];
gc->park_save[0] = NULL;
gc->park_save[1] = NULL;
--gc->dumping_avoid_collection;
}
#ifdef MZ_USE_PLACES