use of org.apache.geode.internal.offheap.RefCountChangeInfo in project geode by apache.
the class OffHeapTestUtil method checkOrphans.
public static void checkOrphans() {
MemoryAllocatorImpl allocator = null;
try {
allocator = MemoryAllocatorImpl.getAllocator();
} catch (CacheClosedException ignore) {
// no off-heap memory so no orphans
return;
}
long end = System.currentTimeMillis() + 5000;
List<MemoryBlock> orphans = allocator.getOrphans();
// Wait for the orphans to go away
while (orphans != null && !orphans.isEmpty() && System.currentTimeMillis() < end) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
orphans = allocator.getOrphans();
}
if (orphans != null && !orphans.isEmpty()) {
List<RefCountChangeInfo> info = ReferenceCountHelper.getRefCountInfo(orphans.get(0).getAddress());
System.out.println("FOUND ORPHAN!!");
System.out.println("Sample orphan: " + orphans.get(0));
System.out.println("Orphan info: " + info);
}
assertEquals(Collections.emptyList(), orphans);
}
Aggregations