- https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html
-Xmxsize Specifies the maximum size (in bytes) of the memory allocation pool in bytes.-XX:NewRatio=old/young By default, this option is set to 2.-XX:SurvivorRatio=eden/survivor By default, this option is set to 8. - 你比如说我设置
-Xmx3212M -XX:NewRatio=3 -XX:SurvivorRatio=9 - https://github.com/alibaba/arthas/blob/555958c6083dd69fdde25b732c831af99215c53c/core/src/main/java/com/taobao/arthas/core/command/monitor200/DashboardCommand.java#L183
MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean(); List<MemoryPoolMXBean> memoryPoolMXBeans = ManagementFactory.getMemoryPoolMXBeans(); MemoryUsage heapMemoryUsage = memoryMXBean.getHeapMemoryUsage(); System.out.println(heapMemoryUsage); for (MemoryPoolMXBean memoryPoolMXBean : memoryPoolMXBeans) { if(MemoryType.HEAP.equals(memoryPoolMXBean.getType())) { System.out.println(memoryPoolMXBean.getName()+"\t"+memoryPoolMXBean.getUsage()); } } - console
init = 134217728(131072K) used = 1698944(1659K) committed = 131596288(128512K) max = 3291480064(3214336K) PS Eden Space init = 28311552(27648K) used = 1698944(1659K) committed = 28311552(27648K) max = 836763648(817152K) PS Survivor Space init = 2621440(2560K) used = 0(0K) committed = 2621440(2560K) max = 2621440(2560K) PS Old Gen init = 100663296(98304K) used = 0(0K) committed = 100663296(98304K) max = 2526019584(2466816K) - Q1: console 和我设的参数是怎么个对应法?
- init used committed max 它们之间关系?
- 3291480064=-Xmx3212M ?就是有点小偏差的?
- -XX:NewRatio=3,指哪列哦? committed ? init ? 3=100663296/(28311552+2621440*2) ?
- -XX:SurvivorRatio=9,指哪列?怎么算?
- Q2: console Survivor 的几个值都是 2621440 ?