Bill Kelly wrote:
> 
> From: "Charles Oliver Nutter" <charles.nutter / sun.com>
>>
>> As some of you may have heard, we're considering disabling 
>> ObjectSpace.each_object by default in JRuby. Primarily, this is for 
>> performance; to support each_object, we have to bend over backwards, 
>> maintaining lists of weak references to all objects in the system and 
>> periodically cleaning out those lists.
> 
> Is this also true for ObjectSpace#_id2ref ?

Not directly. _id2ref is handled in a similar way, but we have an event 
we can trigger off to start tracking an object; namely, Object#id.

When you request an id, we start tracking that object for purposes of 
_id2ref. Not until. So that would not be affected by disabling ObjectSpace.

In actually, however, _id2ref is primarily used for things like weak 
references, so you can hold a virtual reference to an object without 
preventing it from being collected. We could provide an implementation 
of Ruby's weak references using Java's weak references that would allow 
us to escape _id2ref entirely for that use case.

Are there other places _id2ref is used?

- Charlie