зеркало из https://github.com/github/ruby.git
symbol.c: fix memory leak from global fstr hash
* symbol.c (rb_gc_free_dsymbol): delete from global fstr hash * test/ruby/test_symbol.rb (test_symbol_fstr_leak): test for bug [ruby-core:67268] [Bug #10686] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
abe15dddf7
Коммит
8717a9ec86
|
@ -1,3 +1,9 @@
|
|||
Thu Jan 1 11:07:12 2015 Eric Wong <e@80x24.org>
|
||||
|
||||
* symbol.c (rb_gc_free_dsymbol): delete from global fstr hash
|
||||
* test/ruby/test_symbol.rb (test_symbol_fstr_leak): test for bug
|
||||
[ruby-core:67268] [Bug #10686]
|
||||
|
||||
Thu Jan 1 09:14:21 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm_args.c (keyword_hash_p): fix non-symbol keys hash.
|
||||
|
|
1
symbol.c
1
symbol.c
|
@ -664,6 +664,7 @@ rb_gc_free_dsymbol(VALUE sym)
|
|||
if (str) {
|
||||
RSYMBOL(sym)->fstr = 0;
|
||||
unregister_sym(str, sym);
|
||||
rb_hash_delete_entry(global_symbols.dsymbol_fstr_hash, str);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -230,4 +230,12 @@ class TestSymbol < Test::Unit::TestCase
|
|||
end
|
||||
assert_nothing_raised(NoMethodError, bug10259) {obj.send("unagi=".intern, 1)}
|
||||
end
|
||||
|
||||
def test_symbol_fstr_leak
|
||||
bug10686 = '[ruby-core:67268] [Bug #10686]'
|
||||
x = 0
|
||||
assert_no_memory_leak([], '', <<-"end;", bug10686)
|
||||
200_000.times { |i| i.to_s.to_sym }
|
||||
end;
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче