Package org.jruby.runtime
Class ObjectSpace
java.lang.Object
org.jruby.runtime.ObjectSpace
FIXME: This version is faster than the previous, but both suffer from a
crucial flaw: It is impossible to create an ObjectSpace with an iterator
that doesn't either: a. hold on to objects that might otherwise be collected
or b. have no way to guarantee that a call to hasNext() will be correct or
that a subsequent call to next() will produce an object. For our purposes,
for now, this may be acceptable.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final classprivate static classprivate static final classprivate class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ThreadLocal<Reference<ObjectSpace.ObjectGroup>>private final ReferenceQueueprivate final ReferenceQueue<Object>private Reference<ObjectSpace.GroupSweeper>private final Map<Long,ObjectSpace.IdReference> private final Map<IRubyObject,Long> private static final AtomicLongprivate final ReferenceQueue<ObjectSpace.ObjectGroup> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(IRubyObject object) voidaddFinalizer(IRubyObject object, IRubyObject proc) private voidprivate ObjectSpace.ObjectGroupstatic longcalculateObjectId(Object object) private voidprivate voidcleanup(ReferenceQueue<?> referenceQueue) longcreateAndRegisterObjectId(IRubyObject rubyObject) private longcreateId(IRubyObject object) private ObjectSpace.ObjectGroupid2ref(long id) longidOf(IRubyObject rubyObject) Deprecated.iterator(RubyModule rubyClass) private voidvoidregisterObjectId(long id, IRubyObject object) voidremoveFinalizers(long id) private void
-
Field Details
-
deadReferences
-
objectGroupReferenceQueue
-
top
-
deadIdentityReferences
-
identities
-
identitiesByObject
-
maxId
-
currentObjectGroup
-
groupSweeperReference
-
-
Constructor Details
-
ObjectSpace
public ObjectSpace()
-
-
Method Details
-
registerObjectId
-
calculateObjectId
-
createAndRegisterObjectId
-
createId
-
id2ref
-
cleanIdentities
private void cleanIdentities() -
idOf
Deprecated. -
addFinalizer
-
removeFinalizers
public void removeFinalizers(long id) -
add
-
addIndividualWeakReference
-
registerGroupSweeper
private void registerGroupSweeper() -
splitObjectGroups
private void splitObjectGroups() -
iterator
-
cleanup
-
getObjectGroup
-
addObjectGroup
-