From: Charles Nutter Date: 2010-12-21T03:10:26+09:00 Subject: [ruby-core:33787] [Ruby 1.9-Bug#4168] WeakRef is unsafe to use in Ruby 1.9 Issue #4168 has been updated by Charles Nutter. JRuby already maps WeakRef to the native JVM construct. In addition, the "weakling" gem provides reference queues and a simple weak ID hash based on them. Weak references without reference queues are much more difficult to use, since you have to constantly be scanning weak lists/maps/etc for dead references. I would recommend that weakling's API be incorporated into Ruby's weakref support. In addition, there are other types of references from the JVM we would like to expose: * Soft references, which are weak but do not collect unless under GC pressure or if they are untraversed for a certain number of GC cycles * Phantom references, which are only enqueued and cannot be traversed, providing a much cleaner and safer way to implement finalization ---------------------------------------- http://redmine.ruby-lang.org/issues/show/4168 ---------------------------------------- http://redmine.ruby-lang.org