Project

General

Profile

« Previous | Next » 

Revision 5299672a

Added by peterzhu2118 (Peter Zhu) 11 months ago

[PRISM] Fix memory leak in constants

For example, the following code leaks:

code = 1000.times.map { |i| "var#{i} = 1" }.join("\n")

10.times do
  1000.times do
    RubyVM::InstructionSequence.compile_prism(code)
  end

  puts `ps -o rss= -p #{$$}`
end

Before:

70384
88032
103856
115712
125584
132768
144784
152624
165296
180608

After:

62368
78784
74512
87712
85072
77728
69424
74992
71264
81440