Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.

Commit 29de448

Browse files
committed
Merge pull request #30 from ruby-concurrency/update-readme-removes-support-to-mri19-and-mri18
Update readme and drop Ruby 1.8 support
2 parents 0c83003 + 9f8b831 commit 29de448

File tree

4 files changed

+5
-117
lines changed

4 files changed

+5
-117
lines changed

README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ This library also includes tools for some common uses of weak and soft reference
3535

3636
Ruby does come with the `WeakRef` class in the standard library. However, there are [issues with this class](https://bugs.ruby-lang.org/issues/4168) across several different Ruby runtimes. This gem provides a common interface to weak references that works across MRI, Ruby Enterprise Edition, YARV, JRuby and Rubinius.
3737

38-
1. MRI and REE 1.8 - `WeakRef` extends from Delegator which is a very heavy weight class under Ruby 1.8. Creating a `WeakRef` object will allocate thousands of other objects and use up hundreds of kilobytes of memory. This makes `WeakRef` all but unusable even if you only need several hundred of them.
39-
2. YARV 1.9 - `WeakRef` is unsafe to use because the garbage collector can run in a different system thread than a thread allocating memory. This exposes a bug where a `WeakRef` may end up pointing to a completely different object than it originally referenced.
40-
3. Jruby and IronRuby - Jruby and IronRuby using the Ruby 1.8 libraries suffers from the same performance issue with the Delegator class. Furthermore, these VM's don't implement the method used to load an object from the heap using an object id and so cannot use a pure Ruby method to implement weak references.
41-
4. Rubinius - Rubinius implements `WeakRef` with a lighter weight version of delegation and works very well.
42-
5. MRI Ruby 2.0 has a good implementation of `WeakRef`.
38+
1. Rubinius - Rubinius implements `WeakRef` with a lighter weight version of delegation and works very well.
39+
2. MRI Ruby 2.0+ has a good implementation of `WeakRef`.
4340

44-
## BasicObject
45-
46-
Note that weak references will not work with MRI 1.9 or earlier. References will be created, but the objects will never be stored so the reference object will always treat the object as if it is always garbage collected. BasicObject does not implement the necessary methods to maintain the reference.

lib/ref.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ module Ref
1919
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
2020
# If using Rubinius set the implementation to use WeakRef since it is very efficient and using finalizers is not.
2121
require 'ref/weak_reference/weak_ref'
22-
elsif defined?(::ObjectSpace::WeakMap)
23-
# Ruby 2.0 has a working implementation of weakref.rb backed by the new ObjectSpace::WeakMap
24-
require 'ref/weak_reference/weak_ref'
25-
elsif defined?(::ObjectSpace._id2ref)
26-
# If ObjectSpace can lookup objects from their object_id, then use the pure ruby implementation.
27-
require 'ref/weak_reference/pure_ruby'
2822
else
2923
# Otherwise, wrap the standard library WeakRef class
3024
require 'ref/weak_reference/weak_ref'

lib/ref/weak_reference/pure_ruby.rb

Lines changed: 0 additions & 100 deletions
This file was deleted.

ref.gemspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ require 'ref/version'
55
Gem::Specification.new do |s|
66
s.name = 'ref'
77
s.version = Ref::VERSION
8-
s.authors = ['Brian Durand']
9-
s.email = ['bbdurand@gmail.com']
8+
s.authors = ['Brian Durand', 'The Ruby Concurrency Team']
9+
s.email = ['bbdurand@gmail.com', 'concurrent-ruby@googlegroups.com']
1010
s.homepage = "http://github.com/ruby-concurrency/ref"
1111
s.summary = "Library that implements weak, soft, and strong references in Ruby."
12-
s.description = "Library that implements weak, soft, and strong references in Ruby that work across multiple runtimes (MRI, REE, YARV, Jruby and Rubinius). Also includes implementation of maps/hashes that use references and a reference queue."
12+
s.description = "Library that implements weak, soft, and strong references in Ruby that work across multiple runtimes (MRI,Jruby and Rubinius). Also includes implementation of maps/hashes that use references and a reference queue."
1313
s.license = "MIT"
1414
s.date = Time.now.strftime('%Y-%m-%d')
1515

0 commit comments

Comments
 (0)