Issue #9187 has been updated by Usaku NAKAMURA.

Backport changed from 1.9.3: REQUIRED, 2.0.0: REQUIRED to 1.9.3: DONE, 2.0.0: REQUIRED

backported into ruby_1_9_3 at r44948.

----------------------------------------
Bug #9187: st_table leaks when exception is raised in Hash#rehash
https://bugs.ruby-lang.org/issues/9187#change-45124

* Author: Masaki Matsushita
* Status: Closed
* Priority: Normal
* Assignee: Masaki Matsushita
* Category: core
* Target version: 2.1.0
* ruby -v: ruby 2.1.0dev (2013-12-01 trunk 43941) [x86_64-linux]
* Backport: 1.9.3: DONE, 2.0.0: REQUIRED
----------------------------------------
Following code causes leakage of st_table:

class Foo
  def initialize
    @raise = false
  end

  def hash
    raise if @raise
    @raise = true
    return 0
  end
end

h = {Foo.new => true}
10_0000.times do
  h.rehash rescue nil
end



-- 
http://bugs.ruby-lang.org/