2012-05-01 14:53:01 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "A Very blunt test to make sure that we aren't doing stupid leaks" do
|
|
|
|
before do
|
|
|
|
@start_memory = process_memory
|
|
|
|
GC.stress = true
|
|
|
|
end
|
2012-05-03 03:24:15 -04:00
|
|
|
|
2012-05-01 14:53:01 -04:00
|
|
|
after do
|
|
|
|
GC.stress = false
|
|
|
|
end
|
|
|
|
it "won't leak the context" do
|
|
|
|
500.times do
|
2012-05-03 03:24:15 -04:00
|
|
|
# V8::Context.new
|
2012-05-01 14:53:01 -04:00
|
|
|
end
|
|
|
|
gc_completely
|
|
|
|
process_memory.should <= @start_memory * 1.05
|
|
|
|
end
|
|
|
|
|
|
|
|
def process_memory
|
|
|
|
/\w*[ ]*#{Process.pid}[ ]*([.,\d]*)[ ]*([.,\d]*)[ ]*([\d]*)[ ]*([\d]*)/.match(`ps aux`)[4].to_i
|
|
|
|
end
|
|
|
|
|
|
|
|
def gc_completely
|
2012-05-03 03:24:15 -04:00
|
|
|
|
2012-05-01 14:53:01 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|