1、jps: 查看java进程
[root@VM-100-3-centos ~]# jps
7088 Jps
1521 ruoyi-admin.jar
3978 sys_perf_01-0.0.1-SNAPSHOT.jar
[root@VM-100-3-centos ~]#
2、jmap: 查看java内存
[root@VM-100-3-centos ~]# jmap -heap 3978
Attaching to process ID 3978, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.381-b09using thread-local object allocation.
Parallel GC with 4 thread(s)Heap Configuration:MinHeapFreeRatio = 0MaxHeapFreeRatio = 100MaxHeapSize = 1258291200 (1200.0MB)NewSize = 42467328 (40.5MB)MaxNewSize = 419430400 (400.0MB)OldSize = 85458944 (81.5MB)NewRatio = 2SurvivorRatio = 8MetaspaceSize = 21807104 (20.796875MB)CompressedClassSpaceSize = 1073741824 (1024.0MB)MaxMetaspaceSize = 17592186044415 MBG1HeapRegionSize = 0 (0.0MB)Heap Usage:
PS Young Generation
Eden Space:capacity = 191365120 (182.5MB)used = 76968480 (73.40286254882812MB)free = 114396640 (109.09713745117188MB)40.220746602097606% used
From Space:capacity = 7864320 (7.5MB)used = 7667760 (7.3125457763671875MB)free = 196560 (0.1874542236328125MB)97.5006103515625% used
To Space:capacity = 11534336 (11.0MB)used = 0 (0.0MB)free = 11534336 (11.0MB)0.0% used
PS Old Generationcapacity = 63438848 (60.5MB)used = 11229000 (10.708808898925781MB)free = 52209848 (49.79119110107422MB)17.70051057673683% used13102 interned Strings occupying 1125712 bytes.
[root@VM-100-3-centos ~]#
可以看到最大堆内存:MaxHeapSize = 1258291200 (1200.0MB)
这个数值是启动该java 服务时设置的最大内存,如下所示:
java -Xmx1200m -Dserver.port=18001 -jar sys_perf_01-0.0.1-SNAPSHOT.jar