sstephenson/execjs — Issue #64: Memory leak on MRI
Author: joliss
Created: 2012-01-03 15:00:05+00:00
State: open

The following code eats up memory until the OOM killer kills Ruby:

require 'execjs'

p ExecJS.runtime
loop do
1000.times { ExecJS.eval "'red yellow blue'.split(' ')" }
print '.'
end

Output:

#
....Killed

I'm using MRI, `ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]`.

Running therubyracer directly eats up memory too, but at a much much slower rate, well after a million evals.

require 'v8'

cxt = V8::Context.new
loop do
1000.times { cxt.eval "'red yellow blue'.split(' ')" }
print '.'
end