Project

General

Profile

Bug #12614 ยป segv_without_newrelic.rb

wanabe (_ wanabe), 08/14/2016 06:01 AM

 
1
class Foo
2
  GC.start
3
  n = 64 + 32 - 2
4
  z = 5
5
  h = {}
6

    
7
  c = 0
8
  begin
9
    name = "foo#{c+=1}"
10
    i = name.object_id % 128
11
    h[i] ||= []
12
    h[i].push name
13
    names = h[i] if !names || names.size < h[i].size
14
  end while names.size < n * z
15
  names_list = names.each_slice(n).to_a
16

    
17
  [1, n - 8].each do |q|
18
    names_list.each do |names|
19
      names = names[0, q]
20
      names.each do |name|
21
        define_method(name) {}
22
      end
23
      names.each do |name|
24
        remove_method name
25
      end
26
    end
27
  end
28
end