Show unreachable objects in ahat.
But don't count them against heap size or instance counts.
Bug: 33828707
Test: ahat tests, including new InstanceTest.unreachableReferent.
Change-Id: Ic39b6d5569159497dcc76c342e22ed99d2a71307
diff --git a/tools/ahat/test/InstanceTest.java b/tools/ahat/test/InstanceTest.java
index 7173b11..3a50150 100644
--- a/tools/ahat/test/InstanceTest.java
+++ b/tools/ahat/test/InstanceTest.java
@@ -223,6 +223,16 @@
}
@Test
+ public void unreachableReferent() throws IOException {
+ // The test dump program should never be under enough GC pressure for the
+ // soft reference to be cleared. Ensure that ahat will show the soft
+ // reference as having a non-null referent.
+ TestDump dump = TestDump.getTestDump();
+ AhatInstance ref = dump.getDumpedAhatInstance("aSoftReference");
+ assertNotNull(ref.getReferent());
+ }
+
+ @Test
public void gcRootPath() throws IOException {
TestDump dump = TestDump.getTestDump();
@@ -359,14 +369,6 @@
}
@Test
- public void reverseReferencesAreNotUnreachable() throws IOException {
- TestDump dump = TestDump.getTestDump();
- AhatInstance obj = dump.getDumpedAhatInstance("basicString");
- assertEquals(2, obj.getHardReverseReferences().size());
- assertEquals(0, obj.getSoftReverseReferences().size());
- }
-
- @Test
public void asStringEmbedded() throws IOException {
// Set up a heap dump with an instance of java.lang.String of
// "hello" with instance id 0x42 that is backed by a char array that is