1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Don't pin objects if we're just walking the heap

Walking the heap can inadvertently pin objects.  Only mark the object's
pin bit if the mark_func_data pointer is NULL (similar to the mark bits)
This commit is contained in:
Aaron Patterson 2020-08-03 09:22:52 -07:00 committed by Aaron Patterson
parent 1d637b1f5e
commit 3dc313a239
Notes: git 2020-08-04 04:28:35 +09:00

2
gc.c
View file

@ -5313,8 +5313,10 @@ gc_pin(rb_objspace_t *objspace, VALUE obj)
{
GC_ASSERT(is_markable_object(objspace, obj));
if (UNLIKELY(objspace->flags.during_compacting)) {
if (LIKELY(objspace->mark_func_data == NULL)) {
MARK_IN_BITMAP(GET_HEAP_PINNED_BITS(obj), obj);
}
}
}
static inline void