Sha256: 494c8874a793496310d82a67fdd7e0536ab33fad00cefd28b20ecd8d61eea777

Contents?: true

Size: 1.12 KB

Versions: 37

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe "A Very blunt test to make sure that we aren't doing stupid leaks", :memory => true do
  before do
    if Object.const_defined?(:RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
      pending 'need to figure out how to do memory sanity checks on rbx'
    end
    #allocate a single context to make sure that v8 loads its snapshot and
    #we pay the overhead.
    V8::Context.new
    @start_memory = process_memory
    GC.stress = true
  end

  after do
    GC.stress = false
  end
  it "won't increase process memory by more than 50% no matter how many contexts we create" do
    500.times do
       V8::Context.new
       run_v8_gc
    end
    process_memory.should <= @start_memory * 1.5
  end

  it "can eval simple value passing statements repeatedly without significantly increasing memory" do
    V8::C::Locker() do
      cxt = V8::Context.new
      500.times do
        cxt.eval('7 * 6')
        run_v8_gc
      end
    end
      process_memory.should <= @start_memory * 1.1
  end

  def process_memory
    /\w*[ ]*#{Process.pid}[ ]*([.,\d]*)[ ]*([.,\d]*)[ ]*([\d]*)[ ]*([\d]*)/.match(`ps aux`)[4].to_i
  end

end

Version data entries

37 entries across 37 versions & 8 rubygems

Version Path
arcabouco-0.2.13 vendor/bundle/gems/therubyracer-0.12.2/spec/mem/blunt_spec.rb
therubyracer-0.12.3 spec/mem/blunt_spec.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/therubyracer-0.11.4/spec/mem/blunt_spec.rb
therubyracer-xcode-0.12.3 spec/mem/blunt_spec.rb
therubyracer-xcode-0.12.2 spec/mem/blunt_spec.rb
therubyracer-tmpfork-0.12.2 spec/mem/blunt_spec.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/therubyracer-0.12.2/spec/mem/blunt_spec.rb
therubyracer-0.12.2 spec/mem/blunt_spec.rb
therubyracer-0.12.1 spec/mem/blunt_spec.rb
therubyracer-discourse-0.12.0 spec/mem/blunt_spec.rb
therubyracer-0.12.0 spec/mem/blunt_spec.rb
therubyracer-0.11.4 spec/mem/blunt_spec.rb
therubyracer-0.11.3 spec/mem/blunt_spec.rb
therubyracer-0.11.2 spec/mem/blunt_spec.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/therubyracer-0.11.0/spec/mem/blunt_spec.rb
therubyracer-0.11.1 spec/mem/blunt_spec.rb
therubyracer-0.11.1beta1 spec/mem/blunt_spec.rb
therubyracer-0.11.0 spec/mem/blunt_spec.rb
therubyracer-0.11.0beta8-x86-freebsd-9 spec/mem/blunt_spec.rb
therubyracer-0.11.0beta8-x86_64-linux spec/mem/blunt_spec.rb