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

[ruby/fiddle] test: ensure freeing closure

GitHub: GH-102

https://github.com/ruby/fiddle/commit/b2fef1770d
This commit is contained in:
Sutou Kouhei 2022-09-15 07:07:59 +09:00 committed by Hiroshi SHIBATA
parent 824c474c95
commit 9f62768e51

View file

@ -102,11 +102,14 @@ module Fiddle
end
end
def test_memsize
def test_memsize_ruby_dev_42480
require 'objspace'
bug = '[ruby-dev:42480]'
n = 10000
assert_equal(n, n.times {ObjectSpace.memsize_of(Closure.allocate)}, bug)
n.times do
Closure.create(:int, [:void]) do |closure|
ObjectSpace.memsize_of(closure)
end
end
end
%w[INT SHORT CHAR LONG LONG_LONG].each do |name|