ivmai/bdwgc — pull request #30 by Hoops (2013-12-15 16:14:25+00:00)
Title: Loop in GC_alloc_large

Hi, I'm debugging a problem building Guile (that uses bdwgc) with parallel mark. I'm currently working on an issue of the mark stack growing very large in the parallel case, but for the moment this change is needed to stop allocation looping when that happens.

Basically, I bump `GC_collect_at_heapsize` in `GC_add_to_heap`. In the normal case it is recalculated straight after. But in the case where it's called directly from `alloc_mark_stack`, it isn't. If the mark stack gets very large, this can cause `GC_should_collect` to always return true, and `GC_alloc_large` to get stuck in a loop calling `GC_collect_or_expand`.

It's not very satisfactory, but the caller (`alloc_mark_stack`) does not have the ability to recalculate `GC_collect_at_heapsize`, nor probably should it do so as it's outside of alloc.c.