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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章