summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/vm.c b/vm.c
index 77a77ea97b..5acdf2b333 100644
--- a/vm.c
+++ b/vm.c
@@ -1654,14 +1654,15 @@ ruby_vm_destruct(rb_vm_t *vm)
st_free_table(vm->living_threads);
vm->living_threads = 0;
}
+ ruby_vm_run_at_exit_hooks(vm);
+ rb_vm_gvl_destroy(vm);
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
if (objspace) {
rb_objspace_free(objspace);
}
#endif
- ruby_vm_run_at_exit_hooks(vm);
- rb_vm_gvl_destroy(vm);
- ruby_xfree(vm);
+ /* after freeing objspace, you *can't* use ruby_xfree() */
+ ruby_mimfree(vm);
ruby_current_vm = 0;
}
RUBY_FREE_LEAVE("vm");