I think I just succeeded in replicating gavin's hang. It's our old friend the infinite (or at least very long...) loop calling GC_collect_or_expand() repeatedly.
I think perhaps I am going to try an alternate implementation of GC::Anchored.
With a massive document like Gavin's the present implementation is essentially creating several hundred thousand individual GC roots (one gc_malloc_uncollectable()ed shim per object), which might not be such a good thing for the collector.
I am going to CC the libgc mailing list in case Hans wants to reassure me that allocating so many small gc_malloc_uncollectable() objects that all point to nodes in the same large tree is not a problem.
[ note that this is now with the default free space divisor, so we should be using the normal code path ... however, I've not upgraded libgc as 6.3 is still the most recent version available in Debian ]
-mental