ruby-changes:40975
From: nobu <ko1@a...>
Date: Sat, 12 Dec 2015 18:00:43 +0900 (JST)
Subject: [ruby-changes:40975] nobu:r53054 (trunk): vm.c: free tables at destruction
nobu 2015-12-12 18:00:27 +0900 (Sat, 12 Dec 2015) New Revision: 53054 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53054 Log: vm.c: free tables at destruction * vm.c (ruby_vm_destruct): free loading_table and fronzen_strings tables at destruction. Modified files: trunk/vm.c Index: vm.c =================================================================== --- vm.c (revision 53053) +++ vm.c (revision 53054) @@ -2018,6 +2018,13 @@ rb_vm_add_root_module(ID id, VALUE modul https://github.com/ruby/ruby/blob/trunk/vm.c#L2018 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) https://github.com/ruby/ruby/blob/trunk/vm.c#L2040 } 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/