public static List<MemoryManagerMXBean> getMemoryManagerMXBeans() { MemoryManagerMXBean[] mgrs = MemoryImpl.getMemoryManagers(); List<MemoryManagerMXBean> result = new ArrayList<>(mgrs.length); for (MemoryManagerMXBean m : mgrs) { result.add(m); } return result; }
public static List<MemoryPoolMXBean> getMemoryPoolMXBeans() { MemoryPoolMXBean[] pools = MemoryImpl.getMemoryPools(); List<MemoryPoolMXBean> list = new ArrayList<>(pools.length); for (MemoryPoolMXBean p : pools) { list.add(p); } return list; }
public static List<GarbageCollectorMXBean> getGarbageCollectorMXBeans() { MemoryManagerMXBean[] mgrs = MemoryImpl.getMemoryManagers(); List<GarbageCollectorMXBean> result = new ArrayList<>(mgrs.length); for (MemoryManagerMXBean m : mgrs) { if (GarbageCollectorMXBean.class.isInstance(m)) { result.add(GarbageCollectorMXBean.class.cast(m)); } } return result; }