Skip to content

Commit 83d636f

Browse files
committed
Free shapes last
[Bug #21352] `rb_objspace_free_objects` may need to check objects shapes to know how to free them.
1 parent 40c957b commit 83d636f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

vm.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3162,8 +3162,6 @@ ruby_vm_destruct(rb_vm_t *vm)
31623162
// TODO: Is this ignorable for classext->m_tbl ?
31633163
// rb_id_table_free(RCLASS(rb_mRubyVMFrozenCore)->m_tbl);
31643164

3165-
rb_shape_free_all();
3166-
31673165
st_free_table(vm->static_ext_inits);
31683166

31693167
rb_vm_postponed_job_free();
@@ -3222,11 +3220,12 @@ ruby_vm_destruct(rb_vm_t *vm)
32223220
ruby_mimfree(vm);
32233221
ruby_current_vm_ptr = NULL;
32243222

3225-
#if USE_YJIT
32263223
if (rb_free_at_exit) {
3224+
rb_shape_free_all();
3225+
#if USE_YJIT
32273226
rb_yjit_free_at_exit();
3228-
}
32293227
#endif
3228+
}
32303229
}
32313230
RUBY_FREE_LEAVE("vm");
32323231
return 0;

0 commit comments

Comments
 (0)