ruby-changes:62521
From: Aaron <ko1@a...>
Date: Tue, 4 Aug 2020 04:28:19 +0900 (JST)
Subject: [ruby-changes:62521] 3dc313a239 (master): Don't pin objects if we're just walking the heap
https://git.ruby-lang.org/ruby.git/commit/?id=3dc313a239 From 3dc313a239787007afdcad8cfaff6f32c3f0dd28 Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Mon, 3 Aug 2020 09:22:52 -0700 Subject: 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) diff --git a/gc.c b/gc.c index 03649a2..22972df 100644 --- a/gc.c +++ b/gc.c @@ -5313,7 +5313,9 @@ gc_pin(rb_objspace_t *objspace, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L5313 { 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); + } } } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/