Sha256: 8d4c8073770e103491102ea62a07ede737492f9e088b090fd7aa6c4c7da46c8a
Contents?: true
Size: 992 Bytes
Versions: 2
Compression:
Stored size: 992 Bytes
Contents
require 'spec_helper' describe "Memory:" do include V8::ExtSpec context "A JavaScript Object reflected into Ruby" do before do @weakref_callback = WeakrefCallback.new end it "has a strong reference from the ruby side, which is not released until the Ruby reference goes away" do handle = c::Handle::New(object = c::Object::New()) handle.MakeWeak(nil, @weakref_callback) ruby_gc do v8_gc @weakref_callback.should_not have_been_invoked handle.should_not be_dead end ruby_gc do object = nil v8_gc @weakref_callback.should have_been_invoked handle.should be_dead end end private class WeakrefCallback def call(value, parameters) @invoked = true end def has_been_invoked? @invoked end end end #These don't work in 1.8.7. Can't determine why not. I'll probably have to come back to this. end if RUBY_VERSION >= '1.9.2'
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
therubyracer-0.9.0beta2 | spec/ext/mem_spec.rb |
therubyracer-0.9.0beta1 | spec/ext/mem_spec.rb |