在運行時,加入以下jvm配置app
-XX:+PrintGCTimeStamps -XX:-PrintClassHistogram -XX:+PrintHeapAtGC -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCApplicationStoppedTime -XX:+HeapDumpOnOutOfMemoryError
結果以下:jvm
81.156: Total time for which application threads were stopped: 0.0001434 seconds 81.157: Total time for which application threads were stopped: 0.0000822 seconds {Heap before GC invocations=17 (full 3): PSYoungGen total 612864K, used 590848K [0x000000076b380000, 0x000000079bd00000, 0x00000007c0000000) eden space 590848K, 100% used [0x000000076b380000,0x000000078f480000,0x000000078f480000) from space 22016K, 0% used [0x000000078f480000,0x000000078f480000,0x0000000790a00000) to space 20992K, 0% used [0x000000079a880000,0x000000079a880000,0x000000079bd00000) ParOldGen total 228864K, used 55402K [0x00000006c1a00000, 0x00000006cf980000, 0x000000076b380000) object space 228864K, 24% used [0x00000006c1a00000,0x00000006c501abe0,0x00000006cf980000) Metaspace used 62079K, capacity 63014K, committed 63384K, reserved 1105920K class space used 7577K, capacity 7771K, committed 7832K, reserved 1048576K 81.175: [GC (Allocation Failure) [PSYoungGen: 590848K->6748K(713728K)] 646250K->62159K(942592K), 0.0060009 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] Heap after GC invocations=17 (full 3): PSYoungGen total 713728K, used 6748K [0x000000076b380000, 0x000000079af80000, 0x00000007c0000000) eden space 706560K, 0% used [0x000000076b380000,0x000000076b380000,0x0000000796580000) from space 7168K, 94% used [0x000000079a880000,0x000000079af170a8,0x000000079af80000) to space 21504K, 0% used [0x0000000798580000,0x0000000798580000,0x0000000799a80000) ParOldGen total 228864K, used 55410K [0x00000006c1a00000, 0x00000006cf980000, 0x000000076b380000) object space 228864K, 24% used [0x00000006c1a00000,0x00000006c501cbe0,0x00000006cf980000) Metaspace used 62079K, capacity 63014K, committed 63384K, reserved 1105920K class space used 7577K, capacity 7771K, committed 7832K, reserved 1048576K } 81.181: Total time for which application threads were stopped: 0.0063536 seconds 81.321: Total time for which application threads were stopped: 0.0001024 seconds 81.321: Total time for which application threads were stopped: 0.0001510 seconds 81.321: Total time for which application threads were stopped: 0.0000967 seconds 81.341: Total time for which application threads were stopped: 0.0001044 seconds 81.351: Total time for which application threads were stopped: 0.0000907 seconds 81.352: Total time for which application threads were stopped: 0.0000745 seconds 81.352: Total time for which application threads were stopped: 0.0000503 seconds 81.352: Total time for which application threads were stopped: 0.0000370 seconds 81.352: Total time for which application threads were stopped: 0.0000384 seconds 81.352: Total time for which application threads were stopped: 0.0000330 seconds 81.352: Total time for which application threads were stopped: 0.0000319 seconds 81.352: Total time for which application threads were stopped: 0.0000404 seconds 81.352: Total time for which application threads were stopped: 0.0000441 seconds 82.353: Total time for which application threads were stopped: 0.0001843 seconds 86.355: Total time for which application threads were stopped: 0.0002301 seconds 90.358: Total time for which application threads were stopped: 0.0001354 seconds {Heap before GC invocations=18 (full 3): PSYoungGen total 713728K, used 713308K [0x000000076b380000, 0x000000079af80000, 0x00000007c0000000) eden space 706560K, 100% used [0x000000076b380000,0x0000000796580000,0x0000000796580000) from space 7168K, 94% used [0x000000079a880000,0x000000079af170a8,0x000000079af80000) to space 21504K, 0% used [0x0000000798580000,0x0000000798580000,0x0000000799a80000) ParOldGen total 228864K, used 55410K [0x00000006c1a00000, 0x00000006cf980000, 0x000000076b380000) object space 228864K, 24% used [0x00000006c1a00000,0x00000006c501cbe0,0x00000006cf980000) Metaspace used 62117K, capacity 63078K, committed 63384K, reserved 1105920K class space used 7577K, capacity 7771K, committed 7832K, reserved 1048576K 90.458: [GC (Allocation Failure) [PSYoungGen: 713308K->10224K(760832K)] 768719K->65643K(989696K), 0.0059765 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] Heap after GC invocations=18 (full 3): PSYoungGen total 760832K, used 10224K [0x000000076b380000, 0x000000079fd80000, 0x00000007c0000000) eden space 739328K, 0% used [0x000000076b380000,0x000000076b380000,0x0000000798580000) from space 21504K, 47% used [0x0000000798580000,0x0000000798f7c378,0x0000000799a80000) to space 20480K, 0% used [0x000000079e980000,0x000000079e980000,0x000000079fd80000) ParOldGen total 228864K, used 55418K [0x00000006c1a00000, 0x00000006cf980000, 0x000000076b380000) object space 228864K, 24% used [0x00000006c1a00000,0x00000006c501ebe0,0x00000006cf980000) Metaspace used 62117K, capacity 63078K, committed 63384K, reserved 1105920K class space used 7577K, capacity 7771K, committed 7832K, reserved 1048576K } 90.465: Total time for which application threads were stopped: 0.0062805 seconds 91.465: Total time for which application threads were stopped: 0.0001348 seconds 94.467: Total time for which application threads were stopped: 0.0001172 seconds 101.471: Total time for which application threads were stopped: 0.0001161 seconds 103.471: Total time for which application threads were stopped: 0.0001146 seconds 103.471: Total time for which application threads were stopped: 0.0000606 seconds 104.471: Total time for which application threads were stopped: 0.0001169 seconds {Heap before GC invocations=19 (full 3): PSYoungGen total 760832K, used 749552K [0x000000076b380000, 0x000000079fd80000, 0x00000007c0000000) eden space 739328K, 100% used [0x000000076b380000,0x0000000798580000,0x0000000798580000) from space 21504K, 47% used [0x0000000798580000,0x0000000798f7c378,0x0000000799a80000) to space 20480K, 0% used [0x000000079e980000,0x000000079e980000,0x000000079fd80000) ParOldGen total 228864K, used 55418K [0x00000006c1a00000, 0x00000006cf980000, 0x000000076b380000) object space 228864K, 24% used [0x00000006c1a00000,0x00000006c501ebe0,0x00000006cf980000) Metaspace used 62153K, capacity 63078K, committed 63384K, reserved 1105920K class space used 7577K, capacity 7771K, committed 7832K, reserved 1048576K 105.526: [GC (Allocation Failure) [PSYoungGen: 749552K->8165K(841728K)] 804971K->63592K(1070592K), 0.0045184 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] Heap after GC invocations=19 (full 3): PSYoungGen total 841728K, used 8165K [0x000000076b380000, 0x00000007a0d00000, 0x00000007c0000000) eden space 821248K, 0% used [0x000000076b380000,0x000000076b380000,0x000000079d580000) from space 20480K, 39% used [0x000000079e980000,0x000000079f1797b0,0x000000079fd80000) to space 20480K, 0% used [0x000000079d580000,0x000000079d580000,0x000000079e980000) ParOldGen total 228864K, used 55426K [0x00000006c1a00000, 0x00000006cf980000, 0x000000076b380000) object space 228864K, 24% used [0x00000006c1a00000,0x00000006c5020be0,0x00000006cf980000) Metaspace used 62153K, capacity 63078K, committed 63384K, reserved 1105920K class space used 7577K, capacity 7771K, committed 7832K, reserved 1048576K } 105.530: Total time for which application threads were stopped: 0.0048247 seconds 106.531: Total time for which application threads were stopped: 0.0001021 seconds 110.553: Total time for which application threads were stopped: 0.0000893 seconds 111.553: Total time for which application threads were stopped: 0.0001149 seconds {Heap before GC invocations=20 (full 3): PSYoungGen total 841728K, used 829413K [0x000000076b380000, 0x00000007a0d00000, 0x00000007c0000000) eden space 821248K, 100% used [0x000000076b380000,0x000000079d580000,0x000000079d580000) from space 20480K, 39% used [0x000000079e980000,0x000000079f1797b0,0x000000079fd80000) to space 20480K, 0% used [0x000000079d580000,0x000000079d580000,0x000000079e980000) ParOldGen total 228864K, used 55426K [0x00000006c1a00000, 0x00000006cf980000, 0x000000076b380000) object space 228864K, 24% used [0x00000006c1a00000,0x00000006c5020be0,0x00000006cf980000) Metaspace used 62172K, capacity 63078K, committed 63384K, reserved 1105920K class space used 7577K, capacity 7771K, committed 7832K, reserved 1048576K 123.147: [GC (Allocation Failure) [PSYoungGen: 829413K->9125K(841728K)] 884840K->64560K(1070592K), 0.0056110 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] Heap after GC invocations=20 (full 3): PSYoungGen total 841728K, used 9125K [0x000000076b380000, 0x00000007a3500000, 0x00000007c0000000) eden space 821248K, 0% used [0x000000076b380000,0x000000076b380000,0x000000079d580000) from space 20480K, 44% used [0x000000079d580000,0x000000079de697b0,0x000000079e980000) to space 19456K, 0% used [0x00000007a2200000,0x00000007a2200000,0x00000007a3500000) ParOldGen total 228864K, used 55434K [0x00000006c1a00000, 0x00000006cf980000, 0x000000076b380000) object space 228864K, 24% used [0x00000006c1a00000,0x00000006c5022be0,0x00000006cf980000) Metaspace used 62172K, capacity 63078K, committed 63384K, reserved 1105920K class space used 7577K, capacity 7771K, committed 7832K, reserved 1048576K } 123.152: Total time for which application threads were stopped: 0.0059739 seconds
表示新生代對象太多了,分配空間失敗,因此觸發了GCspa
表示新生代內存GC先後分別爲829413K何9125K,總的新生代內存大小爲841728Kcode