JVM学习笔记23内存泄漏 和 VM参数设置

bilibili-JVM学习笔记23
The Java Virtual Machine Specification - Java SE 8 Edition

JVM学习笔记18 字节码知识总结
JVM学习笔记19 JVM内存空间
JVM学习笔记20 jvisualvm
JVM学习笔记21 java 工具
JVM学习笔记22 垃圾回收理论知识

基于 java 1.8.0

Java内存泄露经典原因分析 77

  • Java 内存泄漏的经典原因
    • 对象定义在错误的范围(Wrong Scope)
    • 异常(Exception)处理不当
    • 集合数据管理不当

如果 Foo 实例对象的生命较长,会导致临时性内存泄漏。(这里的 names 变量其实只是临时作用)

class Foo {
    private String[] names;

    public void doIt(int length) {
        if (names == null || names.length < length) {
            names = new String[length];
        }
        populate(names);
    }
}

JVM 喜欢生命周期短的对象,这样做已经足够高效:

class Foo {

    public void doIt(int length) {
        String[] names = new String[length];
        populate(names);
    }
}

异常(Exception)处理不当

    public void test() {
        try {
            Connection connection = DriverManager.getConnection("", "", "");
            PreparedStatement ps = connection.prepareStatement("");
            ResultSet rs = ps.executeQuery();
            while (rs.next()) {
                // 业务操作
            }
            ps.close();
            connection.close();
        } catch (SQLException e) {
            // 业务操作抛出异常将导致 connection 无法关闭,导致内存泄漏和连接泄漏
        }
    }

正确做法:
1.finally 语句中关闭相关资源
2.try-with-resources 优雅关闭资源

    public void test2() {
        try (Connection connection = DriverManager.getConnection("", "", "");
             PreparedStatement ps = connection.prepareStatement("")) {
            ResultSet rs = ps.executeQuery();
            while (rs.next()) {
                // 业务操作
            }
        } catch (SQLException e) {
            // 使用 try-with-resources 优雅关闭资源
        }
    }

  • 集合数据管理不当
    • 当使用 Array-bases 的数据结构(ArrayList,HashMap)时,尽量减少 resize
      • 使用 new ArrayList 时,尽量估算 size ,在创建的时候把 size 确定;
      • 减少 resize 可以避免没有必要的 array copying、gc 碎片等问题;
    • 如果一个 List 只需要顺序访问,不需要随机访问(Random Access),用 LinkedList 代替 ArrayList
      • LinkedList 本质是一个链表,不需要 resize 操作,但只适用于顺序访问;

垃圾回收日志与算法深度解读 78

-Xms20m 堆初始大小
-Xmx20m 最大空间
-Xmn10m 新生代空间大小

package new_package.jvm.p78;

public class MyTest {

    // -verbose:gc -Xms20m -Xmx20m -Xmn10m -XX:+PrintGCDetails -XX:SurvivorRatio=8
    public static void main(String[] args) {
        int sizeM = 1024 * 1024;
        byte[] bytes1 = new byte[3 * sizeM];
        byte[] bytes2 = new byte[3 * sizeM];
        byte[] bytes3 = new byte[3 * sizeM];
        //byte[] bytes4 = new byte[2 * sizeM];

        System.out.println("hello world");
    }
}
[GC (Allocation Failure) [PSYoungGen: 5592K->688K(9216K)] 5592K->3768K(19456K), 0.0034032 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
hello world
Heap
 PSYoungGen      total 9216K, used 7068K [0x00000007bf600000, 0x00000007c0000000, 0x00000007c0000000)
  eden space 8192K, 77% used [0x00000007bf600000,0x00000007bfc3b0f0,0x00000007bfe00000)
  from space 1024K, 67% used [0x00000007bfe00000,0x00000007bfeac010,0x00000007bff00000)
  to   space 1024K, 0% used [0x00000007bff00000,0x00000007bff00000,0x00000007c0000000)
 ParOldGen       total 10240K, used 3080K [0x00000007bec00000, 0x00000007bf600000, 0x00000007bf600000)
  object space 10240K, 30% used [0x00000007bec00000,0x00000007bef02010,0x00000007bf600000)
 Metaspace       used 3259K, capacity 4496K, committed 4864K, reserved 1056768K
  class space    used 346K, capacity 388K, committed 512K, reserved 1048576K
  • 新生代 = 10m (Eden = 8m , s0 = 1m , s1 = 1m ) ,老年代 = 10m
  • GC (Allocation Failure)
    • Allocation Failure 触发 gc 的原因
  • [PSYoungGen: 5592K->688K(9216K)]
    • PS 即 Parallel Scavenge
    • 9216K = 9m
    • 因为 s0 和 s1 只会有一个可用,所以年轻代的实际可用空间为 9m
    • 5592K 新生代gc收集前大小
    • 688K 新生代gc后大小
  • 5592K->3768K(19456K)
    • 5592K 堆空间 gc 前大小
    • 3768K 堆空间 gc 后大小
    • 堆空间大小 19456K (因为有1m不能使用)
  • 0.0034032 secs
    • gc 时间
  • [Times: user=0.01 sys=0.00, real=0.00 secs]
    • 用户态 0.01s
    • 内核态 0.00s
    • 实际耗时 0.00s

5592K - 688K = 4904K // 年轻代 gc 释放的空间
5592K - 3768K = 1824K // 整个堆空间 gc 释放的空间
4904K - 1824K = 3080K // 从年轻代晋升到老年代的空间大小

新生代与老年代垃圾收集器实现详解 79

        int sizeM = 1024 * 1024;
        byte[] bytes1 = new byte[3 * sizeM];
        byte[] bytes2 = new byte[2 * sizeM];
        byte[] bytes3 = new byte[2 * sizeM];
        byte[] bytes4 = new byte[2 * sizeM];
        System.out.println("hello world");
[GC (Allocation Failure) [PSYoungGen: 7640K->688K(9216K)] 7640K->5816K(19456K), 0.0034450 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[Full GC (Ergonomics) [PSYoungGen: 688K->0K(9216K)] [ParOldGen: 5128K->5692K(10240K)] 5816K->5692K(19456K), [Metaspace: 3232K->3232K(1056768K)], 0.0052044 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
hello world
Heap
 PSYoungGen      total 9216K, used 4334K [0x00000007bf600000, 0x00000007c0000000, 0x00000007c0000000)
  eden space 8192K, 52% used [0x00000007bf600000,0x00000007bfa3bb90,0x00000007bfe00000)
  from space 1024K, 0% used [0x00000007bfe00000,0x00000007bfe00000,0x00000007bff00000)
  to   space 1024K, 0% used [0x00000007bff00000,0x00000007bff00000,0x00000007c0000000)
 ParOldGen       total 10240K, used 5692K [0x00000007bec00000, 0x00000007bf600000, 0x00000007bf600000)
  object space 10240K, 55% used [0x00000007bec00000,0x00000007bf18f3e8,0x00000007bf600000)
 Metaspace       used 3240K, capacity 4496K, committed 4864K, reserved 1056768K
  class space    used 346K, capacity 388K, committed 512K, reserved 1048576K
  • Full GC (Ergonomics)
    • 触发条件
  • [PSYoungGen: 688K->0K(9216K)]
    • 年轻代 gc 成果
  • [ParOldGen: 5128K->5692K(10240K)]
    • Par 即 Parallel Old
    • 老年代 gc 成果
  • 5816K->5692K(19456K)
  • [Metaspace: 3232K->3232K(1056768K)]
  • 0.0052044 secs
  • [Times: user=0.00 sys=0.00, real=0.00 secs]

当新对象所需内存空间在新生代上无法满足时,将直接分配在老年代上;

jdk 1.8.0 默认 Parallel Scavenge 和 Parallel Old 收集器

阈值和垃圾收集器类型对于对象分配的影响实战分析 80

java -XX:+PrintCommandLineFlags -version

-XX:InitialHeapSize=268435456 -XX:MaxHeapSize=4294967296 
-XX:+PrintCommandLineFlags -XX:+UseCompressedClassPointers 
-XX:+UseCompressedOops -XX:+UseParallelGC 
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

-XX:+UseParallelGC --> 使用 Parallel Scavenge 和 Parallel Old 收集器


//  -verbose:gc -Xms20m -Xmx20m -Xmn10m -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:+PrintCommandLineFlags -XX:+UseSerialGC -XX:PretenureSizeThreshold=2097152
int sizeM = 1024 * 1024;
byte[] bytes1 = new byte[2 * sizeM];
-XX:InitialHeapSize=20971520 -XX:MaxHeapSize=20971520 -XX:MaxNewSize=10485760 -XX:NewSize=10485760 -XX:PretenureSizeThreshold=2097152 -XX:+PrintCommandLineFlags -XX:+PrintGC -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseSerialGC 
hello world
Heap
 def new generation   total 9216K, used 2684K [0x00000007bec00000, 0x00000007bf600000, 0x00000007bf600000)
  eden space 8192K,  32% used [0x00000007bec00000, 0x00000007bee9f310, 0x00000007bf400000)
  from space 1024K,   0% used [0x00000007bf400000, 0x00000007bf400000, 0x00000007bf500000)
  to   space 1024K,   0% used [0x00000007bf500000, 0x00000007bf500000, 0x00000007bf600000)
 tenured generation   total 10240K, used 3072K [0x00000007bf600000, 0x00000007c0000000, 0x00000007c0000000)
   the space 10240K,  30% used [0x00000007bf600000, 0x00000007bf900010, 0x00000007bf900200, 0x00000007c0000000)
 Metaspace       used 3240K, capacity 4496K, committed 4864K, reserved 1056768K
  class space    used 346K, capacity 388K, committed 512K, reserved 1048576K

PretenureSizeThreshold 指定大小,新对象所需空间大于等于此大小将直接晋升为老年代;
PretenureSizeThreshold 需要与 UseSerialGC 搭配使用;


package new_package.jvm.p78;

// -verbose:gc -Xms20m -Xmx20m -Xmn10m -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:+UseSerialGC
public class MyTest {

    public static void main(String[] args) {
        int sizeM = 1024 * 1024;
        byte[] bytes1 = new byte[2 * sizeM];

        try {
            Thread.sleep(100000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

jps -l

30108 new_package.jvm.p78.MyTest

jcmd 30108 VM.flags

30108:
-XX:CICompilerCount=3 -XX:InitialHeapSize=20971520 -XX:MaxHeapSize=20971520 -XX:MaxNewSize=10485760 -XX:MinHeapDeltaBytes=196608 -XX:NewSize=10485760 -XX:OldSize=10485760 -XX:+PrintGC -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseSerialGC


jmc

Java Mission Control

  • MBean 服务器
  • 飞行记录器

MaxTenuringThreshold 与阈值的动态调整详解 81

-XX:MaxTenuringThreshold=threshold
晋升到老年代的对象年龄(经历一次 gc ,年龄加 1)。当前最大值为15。并行收集器的默认值为15,而CMS的默认值为4。

在可以自动调节对象晋升到老年代阈值的GC中,设置该阈值的最大值;(即没达到这个值也有可能直接晋升到老年代);


// -verbose:gc -Xms20m -Xmx20m -Xmn10m -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:+PrintCommandLineFlags -XX:MaxTenuringThreshold=5 -XX:+PrintTenuringDistribution

package new_package.jvm.p78;

public class MyTest {

    public static void main(String[] args) {
        int sizeM = 1024 * 1024;
        byte[] bytes1 = new byte[2 * sizeM];
        for (int i = 0; i < 100000; i++) {
            byte[] xxx = new byte[1 * sizeM];
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("hello world");
    }
}
-XX:InitialHeapSize=20971520 -XX:InitialTenuringThreshold=5 -XX:MaxHeapSize=20971520 -XX:MaxNewSize=10485760 -XX:MaxTenuringThreshold=5 -XX:NewSize=10485760 -XX:+PrintCommandLineFlags -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintTenuringDistribution -XX:SurvivorRatio=8 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC 
[GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 5 (max 5)
[PSYoungGen: 7640K->688K(9216K)] 7640K->2744K(19456K), 0.0027708 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 5 (max 5)
[PSYoungGen: 8012K->608K(9216K)] 10068K->2664K(19456K), 0.0012135 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] 
[GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 5 (max 5)
[PSYoungGen: 8090K->592K(9216K)] 10146K->2648K(19456K), 0.0015282 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 5 (max 5)
[PSYoungGen: 7912K->592K(9216K)] 9968K->2648K(19456K), 0.0008420 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] 
[GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 4 (max 5)
[PSYoungGen: 7915K->592K(9216K)] 9971K->2648K(19456K), 0.0013556 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 3 (max 5)
[PSYoungGen: 7917K->0K(9216K)] 9973K->2571K(19456K), 0.0012797 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 2 (max 5)
[PSYoungGen: 7326K->0K(9216K)] 9898K->2571K(19456K), 0.0009809 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 1 (max 5)
[PSYoungGen: 7327K->0K(9216K)] 9898K->2571K(19456K), 0.0010516 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] 
[GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 1 (max 5)
[PSYoungGen: 7327K->0K(9216K)] 9899K->2571K(19456K), 0.0003906 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 1 (max 5)
[PSYoungGen: 7327K->0K(9216K)] 9899K->2571K(19456K), 0.0004097 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
...

在 GC 算法中,会计算每个对象的年龄的大小,如果达到某个年龄的总大小已经大于 Survivor 空间的 50% ,那么这时就需要调整阈值,不能再继续使用设置的最大值,让存活的对象尽快晋升到老年代,否则会导致 Survivor 空间不足,然后频繁 gc ;

  • Desired survivor size 1048576 bytes, new threshold 1 (max 5)
    • new threshold 1 : 实际的阈值已降低至 1 次
    • (max 5) : 设置的阈值为 5

实例演示 MaxTenuringThreshold 参数及阈值动态调整策略 82

-XX:TargetSurvivorRatio=60

默认值是 50,即上述说明的的 50% ;这里设置为 60 , 即如果达到某个年龄的总大小已经大于 Survivor 空间的 60%,那么这时会重新调整阈值,让存活的对象尽快晋升到老年代;

-XX:+PrintGCDateStamps

打印执行 GC 时的时间戳;


// -verbose:gc -Xms20m -Xmx20m -Xmn10m -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:+PrintCommandLineFlags -XX:MaxTenuringThreshold=5 -XX:+PrintTenuringDistribution -XX:TargetSurvivorRatio=60 -XX:+PrintGCDateStamps
package new_package.jvm.p78;
public class MyTest {
    public static void main(String[] args) {
        int sizeM = 1024 * 1024;
        byte[] bytes1 = new byte[2 * sizeM];
        for (int i = 0; i < 100000; i++) {
            byte[] xxx = new byte[1 * sizeM];
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("hello world");
    }
}
-XX:InitialHeapSize=20971520 -XX:InitialTenuringThreshold=5 -XX:MaxHeapSize=20971520 -XX:MaxNewSize=10485760 -XX:MaxTenuringThreshold=5 -XX:NewSize=10485760 -XX:+PrintCommandLineFlags -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintTenuringDistribution -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=60 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC 
2020-06-17T18:14:04.162-0800: [GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 5 (max 5)
[PSYoungGen: 7640K->688K(9216K)] 7640K->2744K(19456K), 0.0023285 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:14:11.189-0800: [GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 5 (max 5)
[PSYoungGen: 8012K->624K(9216K)] 10068K->2680K(19456K), 0.0015014 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] 
2020-06-17T18:14:18.215-0800: [GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 5 (max 5)
[PSYoungGen: 8106K->592K(9216K)] 10162K->2648K(19456K), 0.0007712 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:14:25.245-0800: [GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 5 (max 5)
[PSYoungGen: 7912K->608K(9216K)] 9968K->2664K(19456K), 0.0013795 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:14:32.276-0800: [GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 4 (max 5)
[PSYoungGen: 7931K->528K(9216K)] 9987K->2584K(19456K), 0.0008287 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:14:39.306-0800: [GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 3 (max 5)
[PSYoungGen: 7853K->0K(9216K)] 9909K->2579K(19456K), 0.0008763 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:14:46.333-0800: [GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 2 (max 5)
[PSYoungGen: 7326K->0K(9216K)] 9906K->2579K(19456K), 0.0003861 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:14:53.366-0800: [GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 1 (max 5)
[PSYoungGen: 7327K->0K(9216K)] 9906K->2579K(19456K), 0.0005183 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:15:00.396-0800: [GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 1 (max 5)
[PSYoungGen: 7327K->0K(9216K)] 9907K->2579K(19456K), 0.0003928 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:15:07.430-0800: [GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 1 (max 5)
[PSYoungGen: 7327K->0K(9216K)] 9907K->2579K(19456K), 0.0005532 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:15:14.460-0800: [GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 1 (max 5)
[PSYoungGen: 7328K->0K(9216K)] 9907K->2579K(19456K), 0.0003373 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:15:21.489-0800: [GC (Allocation Failure) 
Desired survivor size 1048576 bytes, new threshold 1 (max 5)
[PSYoungGen: 7328K->0K(9216K)] 9907K->2579K(19456K), 0.0003506 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] 

package new_package.jvm.p78;

/**
 * -verbose:gc -Xms20m -Xmx20m -Xmn10m -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:+PrintCommandLineFlags -XX:MaxTenuringThreshold=5 -XX:+PrintTenuringDistribution -XX:TargetSurvivorRatio=60 -XX:+PrintGCDateStamps -XX:+UseConcMarkSweepGC -XX:+UseParNewGC
 */
public class MyTest2 {

    public static void main(String[] args) throws InterruptedException {

        byte[] bytes1 = new byte[512 * 1024];
        byte[] bytes2 = new byte[512 * 1024];

        myGc();
        Thread.sleep(1000);
        System.out.println("11111");

        myGc();
        Thread.sleep(1000);
        System.out.println("22222");

        myGc();
        Thread.sleep(1000);
        System.out.println("33333");

        myGc();
        Thread.sleep(1000);
        System.out.println("44444");

        byte[] bytes3 = new byte[1024 * 1024];
        byte[] bytes4 = new byte[1024 * 1024];
        byte[] bytes5 = new byte[1024 * 1024];

        myGc();
        Thread.sleep(1000);
        System.out.println("55555");

        myGc();
        Thread.sleep(1000);
        System.out.println("66666");

        System.out.println("over------->");
    }

    private static void myGc() {
        for (int i = 0; i < 40; i++) {
            byte[] bytes = new byte[1024 * 1024];
        }
    }
}
-XX:InitialHeapSize=20971520 -XX:InitialTenuringThreshold=5 -XX:MaxHeapSize=20971520 -XX:MaxNewSize=10485760 -XX:MaxTenuringThreshold=5 -XX:NewSize=10485760 -XX:OldPLABSize=16 -XX:+PrintCommandLineFlags -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintTenuringDistribution -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=60 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseConcMarkSweepGC -XX:+UseParNewGC 
2020-06-17T18:32:37.060-0800: [GC (Allocation Failure) 2020-06-17T18:32:37.060-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 1 (max 5)
- age   1:    1034720 bytes,    1034720 total
: 7301K->1024K(9216K), 0.0014362 secs] 7301K->1582K(19456K), 0.0015144 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:37.063-0800: [GC (Allocation Failure) 2020-06-17T18:32:37.063-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   1:       1248 bytes,       1248 total
: 8434K->433K(9216K), 0.0022180 secs] 8992K->2012K(19456K), 0.0022417 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:37.065-0800: [GC (Allocation Failure) 2020-06-17T18:32:37.065-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   2:       1248 bytes,       1248 total
: 7753K->108K(9216K), 0.0003485 secs] 9332K->1687K(19456K), 0.0003756 secs] [Times: user=0.00 sys=0.01, real=0.00 secs] 
2020-06-17T18:32:37.066-0800: [GC (Allocation Failure) 2020-06-17T18:32:37.066-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   1:        424 bytes,        424 total
- age   3:       1120 bytes,       1544 total
: 7485K->27K(9216K), 0.0004079 secs] 9064K->1606K(19456K), 0.0004299 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:37.067-0800: [GC (Allocation Failure) 2020-06-17T18:32:37.067-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   1:       3024 bytes,       3024 total
- age   2:        424 bytes,       3448 total
- age   4:       1120 bytes,       4568 total
: 7387K->8K(9216K), 0.0001944 secs] 8966K->1587K(19456K), 0.0002162 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:37.068-0800: [GC (Allocation Failure) 2020-06-17T18:32:37.068-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   1:        656 bytes,        656 total
- age   2:       2160 bytes,       2816 total
- age   3:        424 bytes,       3240 total
- age   5:       1120 bytes,       4360 total
: 7356K->10K(9216K), 0.0002110 secs] 8935K->1589K(19456K), 0.0002333 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
11111
2020-06-17T18:32:38.071-0800: [GC (Allocation Failure) 2020-06-17T18:32:38.071-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   1:      32616 bytes,      32616 total
- age   2:        608 bytes,      33224 total
- age   3:       2128 bytes,      35352 total
- age   4:        408 bytes,      35760 total
: 7602K->36K(9216K), 0.0010620 secs] 9181K->1616K(19456K), 0.0011108 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:38.072-0800: [GC (Allocation Failure) 2020-06-17T18:32:38.072-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   2:      32496 bytes,      32496 total
- age   3:        608 bytes,      33104 total
- age   4:       2128 bytes,      35232 total
- age   5:        408 bytes,      35640 total
: 7364K->37K(9216K), 0.0008558 secs] 8944K->1617K(19456K), 0.0008848 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:38.074-0800: [GC (Allocation Failure) 2020-06-17T18:32:38.074-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   3:      32496 bytes,      32496 total
- age   4:        608 bytes,      33104 total
- age   5:       2128 bytes,      35232 total
: 7357K->36K(9216K), 0.0017129 secs] 8937K->1617K(19456K), 0.0017419 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:38.076-0800: [GC (Allocation Failure) 2020-06-17T18:32:38.076-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   4:      32496 bytes,      32496 total
- age   5:        608 bytes,      33104 total
: 7359K->36K(9216K), 0.0008802 secs] 8940K->1619K(19456K), 0.0009060 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:38.077-0800: [GC (Allocation Failure) 2020-06-17T18:32:38.077-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   5:      32496 bytes,      32496 total
: 7361K->34K(9216K), 0.0008805 secs] 8944K->1617K(19456K), 0.0009088 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
22222
2020-06-17T18:32:39.083-0800: [GC (Allocation Failure) 2020-06-17T18:32:39.083-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   1:         56 bytes,         56 total
: 7360K->2K(9216K), 0.0008115 secs] 8943K->1617K(19456K), 0.0008354 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:39.084-0800: [GC (Allocation Failure) 2020-06-17T18:32:39.084-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   2:         56 bytes,         56 total
: 7329K->4K(9216K), 0.0007315 secs] 8944K->1619K(19456K), 0.0007523 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:39.085-0800: [GC (Allocation Failure) 2020-06-17T18:32:39.085-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   3:         56 bytes,         56 total
: 7331K->4K(9216K), 0.0007808 secs] 8946K->1619K(19456K), 0.0008017 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:39.087-0800: [GC (Allocation Failure) 2020-06-17T18:32:39.087-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   4:         56 bytes,         56 total
: 7331K->4K(9216K), 0.0007446 secs] 8946K->1619K(19456K), 0.0007680 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:39.088-0800: [GC (Allocation Failure) 2020-06-17T18:32:39.088-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   5:         56 bytes,         56 total
: 7332K->2K(9216K), 0.0007514 secs] 8947K->1617K(19456K), 0.0007731 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:39.089-0800: [GC (Allocation Failure) 2020-06-17T18:32:39.089-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
: 7330K->0K(9216K), 0.0008024 secs] 8945K->1615K(19456K), 0.0008241 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] 
33333
2020-06-17T18:32:40.094-0800: [GC (Allocation Failure) 2020-06-17T18:32:40.094-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   1:         56 bytes,         56 total
: 7328K->2K(9216K), 0.0003570 secs] 8943K->1617K(19456K), 0.0003980 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:40.095-0800: [GC (Allocation Failure) 2020-06-17T18:32:40.095-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   2:         56 bytes,         56 total
: 7330K->4K(9216K), 0.0003333 secs] 8945K->1619K(19456K), 0.0003643 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:40.096-0800: [GC (Allocation Failure) 2020-06-17T18:32:40.096-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   3:         56 bytes,         56 total
: 7332K->2K(9216K), 0.0003445 secs] 8947K->1617K(19456K), 0.0003773 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:40.098-0800: [GC (Allocation Failure) 2020-06-17T18:32:40.098-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   4:         56 bytes,         56 total
: 7330K->2K(9216K), 0.0003611 secs] 8945K->1617K(19456K), 0.0003937 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:40.098-0800: [GC (Allocation Failure) 2020-06-17T18:32:40.098-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   5:         56 bytes,         56 total
: 7330K->2K(9216K), 0.0002670 secs] 8945K->1617K(19456K), 0.0002950 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:40.099-0800: [GC (Allocation Failure) 2020-06-17T18:32:40.099-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
: 7330K->0K(9216K), 0.0002805 secs] 8945K->1615K(19456K), 0.0003101 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
44444
2020-06-17T18:32:41.104-0800: [GC (Allocation Failure) 2020-06-17T18:32:41.104-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   1:         56 bytes,         56 total
: 7328K->4K(9216K), 0.0028450 secs] 8943K->4691K(19456K), 0.0028815 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:41.107-0800: [GC (Allocation Failure) 2020-06-17T18:32:41.107-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   2:         56 bytes,         56 total
: 7332K->2K(9216K), 0.0002808 secs] 12019K->4689K(19456K), 0.0003165 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:41.108-0800: [GC (Allocation Failure) 2020-06-17T18:32:41.108-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   3:         56 bytes,         56 total
: 7330K->4K(9216K), 0.0008013 secs] 12017K->4691K(19456K), 0.0008287 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:41.109-0800: [GC (Allocation Failure) 2020-06-17T18:32:41.109-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   4:         56 bytes,         56 total
: 7332K->4K(9216K), 0.0002828 secs] 12019K->4691K(19456K), 0.0003108 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] 
2020-06-17T18:32:41.110-0800: [GC (Allocation Failure) 2020-06-17T18:32:41.110-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   5:         56 bytes,         56 total
: 7332K->4K(9216K), 0.0003487 secs] 12019K->4691K(19456K), 0.0003762 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:41.111-0800: [GC (Allocation Failure) 2020-06-17T18:32:41.111-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
: 7332K->0K(9216K), 0.0002626 secs] 12019K->4687K(19456K), 0.0002929 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
55555
2020-06-17T18:32:42.116-0800: [GC (Allocation Failure) 2020-06-17T18:32:42.116-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   1:         56 bytes,         56 total
: 7328K->4K(9216K), 0.0003625 secs] 12015K->4691K(19456K), 0.0004004 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:42.117-0800: [GC (Allocation Failure) 2020-06-17T18:32:42.117-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   2:         56 bytes,         56 total
: 7332K->4K(9216K), 0.0003376 secs] 12019K->4691K(19456K), 0.0003695 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:42.118-0800: [GC (Allocation Failure) 2020-06-17T18:32:42.118-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   3:         56 bytes,         56 total
: 7332K->4K(9216K), 0.0003231 secs] 12019K->4691K(19456K), 0.0003587 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:42.118-0800: [GC (Allocation Failure) 2020-06-17T18:32:42.118-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   4:         56 bytes,         56 total
: 7332K->4K(9216K), 0.0003903 secs] 12019K->4691K(19456K), 0.0004180 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
2020-06-17T18:32:42.119-0800: [GC (Allocation Failure) 2020-06-17T18:32:42.119-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
- age   5:         56 bytes,         56 total
: 7332K->4K(9216K), 0.0007897 secs] 12019K->4691K(19456K), 0.0008144 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] 
2020-06-17T18:32:42.121-0800: [GC (Allocation Failure) 2020-06-17T18:32:42.121-0800: [ParNew
Desired survivor size 629144 bytes, new threshold 5 (max 5)
: 7332K->0K(9216K), 0.0002614 secs] 12019K->4687K(19456K), 0.0002857 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
66666
over------->
Heap
 par new generation   total 9216K, used 1348K [0x00000007bec00000, 0x00000007bf600000, 0x00000007bf600000)
  eden space 8192K,  16% used [0x00000007bec00000, 0x00000007bed511f8, 0x00000007bf400000)
  from space 1024K,   0% used [0x00000007bf500000, 0x00000007bf500000, 0x00000007bf600000)
  to   space 1024K,   0% used [0x00000007bf400000, 0x00000007bf400000, 0x00000007bf500000)
 concurrent mark-sweep generation total 10240K, used 4687K [0x00000007bf600000, 0x00000007c0000000, 0x00000007c0000000)
 Metaspace       used 3254K, capacity 4496K, committed 4864K, reserved 1056768K
  class space    used 346K, capacity 388K, committed 512K, reserved 1048576K
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值