1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

vm.c: free tables at destruction

* vm.c (ruby_vm_destruct): free loading_table and fronzen_strings
  tables at destruction.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-12-12 09:00:27 +00:00
parent d79b5e1921
commit 8e5595b5ee

16
vm.c
View file

@ -2018,6 +2018,13 @@ rb_vm_add_root_module(ID id, VALUE module)
return TRUE;
}
static int
free_loading_table_entry(st_data_t key, st_data_t value, st_data_t arg)
{
xfree((char *)key);
return ST_DELETE;
}
int
ruby_vm_destruct(rb_vm_t *vm)
{
@ -2033,6 +2040,15 @@ ruby_vm_destruct(rb_vm_t *vm)
}
rb_vm_living_threads_init(vm);
ruby_vm_run_at_exit_hooks(vm);
if (vm->loading_table) {
st_foreach(vm->loading_table, free_loading_table_entry, 0);
st_free_table(vm->loading_table);
vm->loading_table = 0;
}
if (vm->frozen_strings) {
st_free_table(vm->frozen_strings);
vm->frozen_strings = 0;
}
rb_vm_gvl_destroy(vm);
if (objspace) {
rb_objspace_free(objspace);