An example of the type of problem I see being difficult to solve with runtime
checking is this one:
a = allocate_big_object(); // triggers GC 99.9% of the time
free(a);
b = allocate_tiny_object(); // basically never triggers GC
c = allocate_another_object(); // triggers GC if `a` didn't
JL_GC_PUSH2(&b, &c);
b basically never triggers GC because a usually forces a GC, and b is not big
enough to trigger a GC. Even when a doesn't trigger a GC, it's tiny, so
doesn't usually cross threshold. But c is big enough to reliably cross
threshold. In that 0.1% of the time, allocation of c will force a GC before
you've protected b with your GC_PUSH2. But since it happens very rarely, it's
hard to catch at runtime.
--Tim