< prev index next >

test/hotspot/jtreg/gc/shenandoah/mxbeans/TestMemoryMXBeans.java

Print this page
rev 53841 : 8219524: Shenandoah misreports "committed" size in MemoryMXBean
Reviewed-by: XXX

*** 50,66 **** --- 50,72 ---- } public static void testMemoryBean(long initSize, long maxSize) { MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean(); long heapInit = memoryMXBean.getHeapMemoryUsage().getInit(); + long heapCommitted = memoryMXBean.getHeapMemoryUsage().getCommitted(); long heapMax = memoryMXBean.getHeapMemoryUsage().getMax(); long nonHeapInit = memoryMXBean.getNonHeapMemoryUsage().getInit(); + long nonHeapCommitted = memoryMXBean.getNonHeapMemoryUsage().getCommitted(); long nonHeapMax = memoryMXBean.getNonHeapMemoryUsage().getMax(); if (initSize > 0 && heapInit != initSize) { throw new IllegalStateException("Init heap size is wrong: " + heapInit + " vs " + initSize); } if (maxSize > 0 && heapMax != maxSize) { throw new IllegalStateException("Max heap size is wrong: " + heapMax + " vs " + maxSize); } + if (initSize > 0 && maxSize > 0 && initSize != maxSize && heapCommitted == heapMax) { + throw new IllegalStateException("Init committed heap size is wrong: " + heapCommitted + + " (init: " + initSize + ", max: " + maxSize + ")"); + } } }
< prev index next >