ruby-changes:33772
From: nobu <ko1@a...>
Date: Wed, 7 May 2014 13:26:48 +0900 (JST)
Subject: [ruby-changes:33772] nobu:r45853 (trunk): vm.c: clear intermediate hash
nobu 2014-05-07 13:26:44 +0900 (Wed, 07 May 2014) New Revision: 45853 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45853 Log: vm.c: clear intermediate hash * vm.c (rb_f_local_variables): clear intermediate hash after extracting its keys. Modified files: trunk/vm_eval.c Index: vm_eval.c =================================================================== --- vm_eval.c (revision 45852) +++ vm_eval.c (revision 45853) @@ -1887,6 +1887,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1887 rb_f_local_variables(void) { VALUE vars = rb_hash_new(); + VALUE ary; rb_thread_t *th = GET_THREAD(); rb_control_frame_t *cfp = vm_get_ruby_level_caller_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp)); @@ -1924,7 +1925,9 @@ rb_f_local_variables(void) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1925 } /* TODO: rb_hash_keys() directly, or something not to depend on * the order of st_table */ - return rb_funcallv(vars, rb_intern("keys"), 0, 0); + ary = rb_funcallv(vars, rb_intern("keys"), 0, 0); + rb_hash_clear(vars); + return ary; } /* -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/