Java programmatic memory analysis
public static void main(String[] args) { MemoryMXBean mbean = ManagementFactory.getMemoryMXBean(); System.out.println(mbean.getHeapMemoryUsage()); System.out.println("Avail " + (mbean.getHeapMemoryUsage().getMax() - mbean.getHeapMemoryUsage().getUsed()) / 1024 + "KB"); List mbeans = ManagementFactory.getMemoryPoolMXBeans(); for (MemoryPoolMXBean bean : mbeans) { String name = bean.getName(); MemoryType type = bean.getType(); MemoryUsage usage = bean.getUsage(); MemoryUsage peak = bean.getPeakUsage(); MemoryUsage coll = bean.getCollectionUsage(); System.out.println(String.format("%s, type=%s, usage=%s, peak=%s, coll=%s", name, type, usage, peak, coll)); ...