Fix memory corruption that can occur during a Ruby GC run.