GC bug fix

Replicate 4266e60 for the v5.3.6 release.

This repair omits one part of the original commit,
which is the `gc->dumping_avoid_collection' test
in check_used_against_max(). It's unlikely to matter,
and I'm not sure that check is correct without some
additional changes that seem too complex to try to
include the release.
fix GC bug in FFI

Replicate e3eed89 for v5.3.6.