1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00

use native weakref implementation for ruby 2.0

This commit is contained in:
Charles Lowell 2013-02-25 21:59:45 -06:00
parent d8b8f3c6c2
commit 8385158d35

View file

@ -3,11 +3,14 @@ module V8
# weak refs are broken on MRI 1.9 and merely slow on 1.8
# so we mitigate this by using the 'ref' gem. However, this
# only mitigates the problem. Under heavy load, you will still
# get different or terminated objects being returned. bad stuff
# get different or terminated objects being returned. bad stuff.
#
# If you are having problems with this, an upgrade to 2.0 is *highly*
# recommended.
#
# for other platforms we just use the stdlib 'weakref'
# implementation
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby'
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby' && RUBY_VERSION < '2.0.0'
require 'ref'
Ref = ::Ref::WeakReference
WeakValueMap = ::Ref::WeakValueMap