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

Update readme and drop Ruby 1.8 support #30

Merged
merged 2 commits into from
Mar 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ This library also includes tools for some common uses of weak and soft reference

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.

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.
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.
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.
4. Rubinius - Rubinius implements `WeakRef` with a lighter weight version of delegation and works very well.
5. MRI Ruby 2.0 has a good implementation of `WeakRef`.
1. Rubinius - Rubinius implements `WeakRef` with a lighter weight version of delegation and works very well.
2. MRI Ruby 2.0+ has a good implementation of `WeakRef`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are dropping 1.9 too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pitr-ch Yes, I believe there is no reason to support Ruby 1.9 in the next releases because MRI 1.9 is officially dead: https://www.ruby-lang.org/en/news/2015/02/23/support-for-ruby-1-9-3-has-ended/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support for MRI 1.9 has ended, but I've never seen any data indicating that people aren't still using it in production. So I would hesitate to say it's actually dead. For this gem and this release I think dropping 1.9 support is OK. We aren't adding any new features or fixing bugs. The main goal of this release is to drop support for old versions of Ruby (mainly MRI 1.8 and IronRuby). MRI 1.9 users will still be able to use the 1.x release so we won't be disenfranchising any users. I would argue against dropping support for MRI 1.9 in any of our other gems, however.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this gem our (concurrent-ruby) dependency? It would force concurrent-ruby to 2.0 too, or am I mistaken? Also, We (Dynflow -> Foreman -> Katello) need 1.9 MRI still supported, since MRI 1.9 RPMs are supported. cc @iNecas

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pitr-ch Yes, you are correct. I completely lost sight of that when I post my previous response. The original suggestion in #22 was to drop support for MRI 1.8 and Iron Ruby and I think we should stick with that. My previous comment was in error. We should retain support for MRI in 1.9 until we are ready to remove MRI 1.9 support from concurrent-ruby. Thanks for catching that!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#33


## BasicObject

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.
6 changes: 0 additions & 6 deletions lib/ref.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ module Ref
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
# If using Rubinius set the implementation to use WeakRef since it is very efficient and using finalizers is not.
require 'ref/weak_reference/weak_ref'
elsif defined?(::ObjectSpace::WeakMap)
# Ruby 2.0 has a working implementation of weakref.rb backed by the new ObjectSpace::WeakMap
require 'ref/weak_reference/weak_ref'
elsif defined?(::ObjectSpace._id2ref)
# If ObjectSpace can lookup objects from their object_id, then use the pure ruby implementation.
require 'ref/weak_reference/pure_ruby'
else
# Otherwise, wrap the standard library WeakRef class
require 'ref/weak_reference/weak_ref'
Expand Down
100 changes: 0 additions & 100 deletions lib/ref/weak_reference/pure_ruby.rb

This file was deleted.

6 changes: 3 additions & 3 deletions ref.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ require 'ref/version'
Gem::Specification.new do |s|
s.name = 'ref'
s.version = Ref::VERSION
s.authors = ['Brian Durand']
s.email = ['bbdurand@gmail.com']
s.authors = ['Brian Durand', 'The Ruby Concurrency Team']
s.email = ['bbdurand@gmail.com', 'concurrent-ruby@googlegroups.com']
s.homepage = "http://github.com/ruby-concurrency/ref"
s.summary = "Library that implements weak, soft, and strong references in Ruby."
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."
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."
s.license = "MIT"
s.date = Time.now.strftime('%Y-%m-%d')

Expand Down