Skip to content

Commit

Permalink
Showing 2 changed files with 26 additions and 0 deletions.
20 changes: 20 additions & 0 deletions spec/truffle/specs/truffle/objspace/reachable_objects_from_spec.rb
Original file line number Diff line number Diff line change
@@ -34,4 +34,24 @@
reachable = reachable + reachable.flat_map { |r| ObjectSpace.reachable_objects_from(r) }
reachable.should include(captured)
end

it "finds an object stored in a Queue" do
require 'thread'
o = Object.new
q = Queue.new
q << o

reachable = ObjectSpace.reachable_objects_from(q)
reachable.should include(o)
end

it "finds an object stored in a SizedQueue" do
require 'thread'
o = Object.new
q = SizedQueue.new(3)
q << o

reachable = ObjectSpace.reachable_objects_from(q)
reachable.should include(o)
end
end
Original file line number Diff line number Diff line change
@@ -136,6 +136,12 @@ public static Set<DynamicObject> getAdjacentObjects(DynamicObject object) {
reachable.add((DynamicObject) element);
}
}
} else if (propertyValue instanceof Collection<?>) {
for (Object element : ((Collection<?>) propertyValue)) {
if (element instanceof DynamicObject) {
reachable.add((DynamicObject) element);
}
}
} else if (propertyValue instanceof Frame) {
reachable.addAll(getObjectsInFrame((Frame) propertyValue));
} else if (propertyValue instanceof ObjectGraphNode) {

0 comments on commit 7b0e0da

Please sign in to comment.