GC日志分析

tech2023-02-16  145

GC日志分析

1.概述 2.Minor GC日志 3.Full GC日志 4.举例

package com.atguigu.java; /** * 在jdk7 和 jdk8中分别执行 * -verbose:gc -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:+UseSerialGC * @author shkstart shkstart@126.com * @create 2020 0:12 */ public class GCLogTest1 { private static final int _1MB = 1024 * 1024; public static void testAllocation() { byte[] allocation1, allocation2, allocation3, allocation4; allocation1 = new byte[2 * _1MB]; allocation2 = new byte[2 * _1MB]; allocation3 = new byte[2 * _1MB]; allocation4 = new byte[4 * _1MB]; } public static void main(String[] agrs) { testAllocation(); } }

5.GC日志分析工具

最新回复(0)