diff options
author | Aaron Patterson <tenderlove@ruby-lang.org> | 2020-08-03 09:22:52 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2020-08-03 12:28:00 -0700 |
commit | 3dc313a239787007afdcad8cfaff6f32c3f0dd28 (patch) | |
tree | c2efd00057aa8c943aed1b0aefd6ab945a270a8f /gc.c | |
parent | 1d637b1f5ec77534ceb700e326a9401a0f32ef0c (diff) | |
download | ruby-3dc313a239787007afdcad8cfaff6f32c3f0dd28.tar.gz |
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)
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -5313,7 +5313,9 @@ gc_pin(rb_objspace_t *objspace, VALUE obj) { GC_ASSERT(is_markable_object(objspace, obj)); if (UNLIKELY(objspace->flags.during_compacting)) { - MARK_IN_BITMAP(GET_HEAP_PINNED_BITS(obj), obj); + if (LIKELY(objspace->mark_func_data == NULL)) { + MARK_IN_BITMAP(GET_HEAP_PINNED_BITS(obj), obj); + } } } |