Skip to content

Commit e76c9c1

Browse files
committed
More debug object_id
1 parent 42e4610 commit e76c9c1

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

gc.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1912,10 +1912,16 @@ object_id_to_ref(void *objspace_ptr, VALUE object_id)
19121912
static inline void
19131913
obj_free_object_id(VALUE obj)
19141914
{
1915+
if (FL_TEST_RAW(obj, RUBY_FL_UNUSED9)) {
1916+
rb_bug("already freed that object_id %s", rb_obj_info(obj));
1917+
}
1918+
else {
1919+
FL_SET_RAW(obj, RUBY_FL_UNUSED9);
1920+
}
1921+
19151922
if (RB_UNLIKELY(id_to_obj_tbl)) {
19161923
if (rb_shape_obj_has_id(obj)) {
19171924
VALUE obj_id = rb_obj_id(obj);
1918-
fprintf(stderr, "obj_free_object_id id=%s obj=%s\n", rb_obj_info(obj_id), rb_obj_info(obj));
19191925
st_data_t id = (st_data_t)obj_id;
19201926
GC_ASSERT(id);
19211927

@@ -1934,6 +1940,7 @@ rb_gc_obj_free_vm_weak_references(VALUE obj)
19341940
if (FL_TEST(obj, FL_EXIVAR)) {
19351941
rb_free_generic_ivar((VALUE)obj);
19361942
FL_UNSET(obj, FL_EXIVAR);
1943+
// obj_free_object_id(obj);
19371944
}
19381945

19391946
switch (BUILTIN_TYPE(obj)) {
@@ -5283,6 +5290,7 @@ rb_gc_after_fork(rb_pid_t pid)
52835290
void
52845291
Init_GC(void)
52855292
{
5293+
id_to_obj_tbl = st_init_table(&object_id_hash_type);
52865294
#undef rb_intern
52875295
rb_gc_register_address(&id_to_obj_value);
52885296

0 commit comments

Comments
 (0)