关于JVM运行时的一些记录
jmap
首先根据jps查看当前有那些进程
**jmap -heap 2072 //查看进程2072的堆内存情况**
Attaching to process ID 2072, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.102-b14
using thread-local object allocation.
**Parallel GC with 13 thread(s)** **使用的垃圾回收器**
Heap Configuration:
MinHeapFreeRatio = 0
MaxHeapFreeRatio = 100
**MaxHeapSize = 8573157376 (8176.0MB)**
NewSize = 178782208 (170.5MB)
MaxNewSize = 2857369600 (2725.0MB)
OldSize = 358088704 (341.5MB)
NewRatio = 2
SurvivorRatio = 8
MetaspaceSize = 21807104 (20.796875MB)
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 17592186044415 MB
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
PS Young Generation
Eden Space:
capacity = 181403648 (173.0MB)
used = 23999248 (22.887466430664062MB)
free = 157404400 (150.11253356933594MB)
13.22974938188674% used
From Space:
capacity = 7340032 (7.0MB)
used = 6849280 (6.531982421875MB)
free = 490752 (0.468017578125MB)
93.31403459821429% used
To Space:
capacity = 16252928 (15.5MB)
used = 0 (0.0MB)
free = 16252928 (15.5MB)
0.0% used
PS Old Generation
capacity = 341835776 (326.0MB)
used = 16808688 (16.030014038085938MB)
free = 325027088 (309.96998596191406MB)
4.91718222027176% used
19455 interned Strings occupying 2016776 bytes.
查看GC详情日志
参数文本如下
-XX:+PrintGCDetails
-Xloggc:D:\gc.logs
-XX:+PrintGCTimeStamps
-XX:+PrintGCDateStamps
-XX:+PrintHeapAtGC
从D:\gc.logs下粘贴出部分文本
Java HotSpot(TM) 64-Bit Server VM (25.102-b14) for windows-amd64 JRE (1.8.0_102-b14), built on Jun 22 2016 13:15:21 by "java_re" with MS VC++ 10.0 (VS2010)
Memory: 4k page, physical 33483976k(19991180k free), swap 35581128k(13826192k free)
CommandLine flags: -XX:-BytecodeVerificationLocal -XX:-BytecodeVerificationRemote -XX:InitialHeapSize=535743616 -XX:+ManagementServer -XX:MaxHeapSize=8571897856 -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -XX:TieredStopAtLevel=1 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC
{Heap before GC invocations=1 (full 0):
PSYoungGen total 153088K, used 131584K [0x0000000715b00000, 0x0000000720580000, 0x00000007c0000000)
eden space 131584K, 100% used [0x0000000715b00000,0x000000071db80000,0x000000071db80000)
from space 21504K, 0% used [0x000000071f080000,0x000000071f080000,0x0000000720580000)
to space 21504K, 0% used [0x000000071db80000,0x000000071db80000,0x000000071f080000)
ParOldGen total 349696K, used 0K [0x00000005c1000000, 0x00000005d6580000, 0x0000000715b00000)
object space 349696K, 0% used [0x00000005c1000000,0x00000005c1000000,0x00000005d6580000)
Metaspace used 18311K, capacity 19188K, committed 19328K, reserved 1067008K
class space used 2422K, capacity 2635K, committed 2688K, reserved 1048576K
2023-03-05T18:52:31.236+0800: 1.185: [GC (Allocation Failure) [PSYoungGen: 131584K->13711K(153088K)] 131584K->13735K(502784K), 0.0103077 secs] [Times: user=0.16 sys=0.05, real=0.01 secs]
Heap after GC invocations=1 (full 0):
PSYoungGen total 153088K, used 13711K [0x0000000715b00000, 0x0000000720580000, 0x00000007c0000000)
eden space 131584K, 0% used [0x0000000715b00000,0x0000000715b00000,0x000000071db80000)
from space 21504K, 63% used [0x000000071db80000,0x000000071e8e3de0,0x000000071f080000)
to space 21504K, 0% used [0x000000071f080000,0x000000071f080000,0x0000000720580000)
ParOldGen total 349696K, used 24K [0x00000005c1000000, 0x00000005d6580000, 0x0000000715b00000)
object space 349696K, 0% used [0x00000005c1000000,0x00000005c1006000,0x00000005d6580000)
Metaspace used 18311K, capacity 19188K, committed 19328K, reserved 1067008K
class space used 2422K, capacity 2635K, committed 2688K, reserved 1048576K
}
{Heap before GC invocations=2 (full 0):
PSYoungGen total 153088K, used 70289K [0x0000000715b00000, 0x0000000720580000, 0x00000007c0000000)
eden space 131584K, 42% used [0x0000000715b00000,0x0000000719240780,0x000000071db80000)
from space 21504K, 63% used [0x000000071db80000,0x000000071e8e3de0,0x000000071f080000)
to space 21504K, 0% used [0x000000071f080000,0x000000071f080000,0x0000000720580000)
ParOldGen total 349696K, used 24K [0x00000005c1000000, 0x00000005d6580000, 0x0000000715b00000)
object space 349696K, 0% used [0x00000005c1000000,0x00000005c1006000,0x00000005d6580000)
Metaspace used 20164K, capacity 21222K, committed 21296K, reserved 1067008K
class space used 2694K, capacity 2924K, committed 2944K, reserved 1048576K
2023-03-05T18:52:31.512+0800: 1.460: [GC (Metadata GC Threshold) [PSYoungGen: 70289K->11357K(153088K)] 70313K->11389K(502784K), 0.0075807 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
Heap after GC invocations=2 (full 0):
PSYoungGen total 153088K, used 11357K [0x0000000715b00000, 0x0000000728600000, 0x00000007c0000000)
eden space 131584K, 0% used [0x0000000715b00000,0x0000000715b00000,0x000000071db80000)
from space 21504K, 52% used [0x000000071f080000,0x000000071fb97678,0x0000000720580000)
to space 21504K, 0% used [0x000000071db80000,0x000000071db80000,0x000000071f080000)
ParOldGen total 349696K, used 32K [0x00000005c1000000, 0x00000005d6580000, 0x0000000715b00000)
object space 349696K, 0% used [0x00000005c1000000,0x00000005c1008000,0x00000005d6580000)
Metaspace used 20164K, capacity 21222K, committed 21296K, reserved 1067008K
class space used 2694K, capacity 2924K, committed 2944K, reserved 1048576K
}
{Heap before GC invocations=3 (full 1):
PSYoungGen total 153088K, used 11357K [0x0000000715b00000, 0x0000000728600000, 0x00000007c0000000)
eden space 131584K, 0% used [0x0000000715b00000,0x0000000715b00000,0x000000071db80000)
from space 21504K, 52% used [0x000000071f080000,0x000000071fb97678,0x0000000720580000)
to space 21504K, 0% used [0x000000071db80000,0x000000071db80000,0x000000071f080000)
ParOldGen total 349696K, used 32K [0x00000005c1000000, 0x00000005d6580000, 0x0000000715b00000)
object space 349696K, 0% used [0x00000005c1000000,0x00000005c1008000,0x00000005d6580000)
Metaspace used 20164K, capacity 21222K, committed 21296K, reserved 1067008K
class space used 2694K, capacity 2924K, committed 2944K, reserved 1048576K
2023-03-05T18:52:31.520+0800: 1.467: [Full GC (Metadata GC Threshold) [PSYoungGen: 11357K->0K(153088K)] [ParOldGen: 32K->10901K(203264K)] 11389K->10901K(356352K), [Metaspace: 20164K->20164K(1067008K)], 0.0209644 secs] [Times: user=0.38 sys=0.02, real=0.02 secs]
Heap after GC invocations=3 (full 1):
PSYoungGen total 153088K, used 0K [0x0000000715b00000, 0x0000000728600000, 0x00000007c0000000)
eden space 131584K, 0% used [0x0000000715b00000,0x0000000715b00000,0x000000071db80000)
from space 21504K, 0% used [0x000000071f080000,0x000000071f080000,0x0000000720580000)
to space 21504K, 0% used [0x000000071db80000,0x000000071db80000,0x000000071f080000)
ParOldGen total 203264K, used 10901K [0x00000005c1000000, 0x00000005cd680000, 0x0000000715b00000)
object space 203264K, 5% used [0x00000005c1000000,0x00000005c1aa5580,0x00000005cd680000)
Metaspace used 20164K, capacity 21222K, committed 21296K, reserved 1067008K
class space used 2694K, capacity 2924K, committed 2944K, reserved 1048576K
}