Skip to content

Commit

Permalink
Add check for T_NONE in rb_gc_mark_weak
Browse files Browse the repository at this point in the history
This commit adds a check for T_NONE in rb_gc_mark_weak, just like
gc_mark_ptr. This will help debugging.
  • Loading branch information
peterzhu2118 committed Sep 5, 2023
1 parent 5b15799 commit ef65183
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gc.c
Expand Up @@ -6903,6 +6903,11 @@ rb_gc_mark_weak(VALUE *ptr)

GC_ASSERT(objspace->rgengc.parent_object == 0 || FL_TEST(objspace->rgengc.parent_object, FL_WB_PROTECTED));

if (UNLIKELY(RB_TYPE_P(obj, T_NONE))) {
rp(obj);
rb_bug("try to mark T_NONE object");
}

/* If we are in a minor GC and the other object is old, then obj should
* already be marked and cannot be reclaimed in this GC cycle so we don't
* need to add it to the weak refences list. */
Expand Down

0 comments on commit ef65183

Please sign in to comment.