1、专门查看java 进程的工具 jps
官网链接:jps官方文档
输入命令:jps -l
kjctar@kjctar-virtual-machine:~/Downloads/apache-tomcat-8.5.50/bin$ jps -l
5376 org.apache.catalina.startup.Bootstrap (第一个数字是pid 第二个是java进程名,这里是tomcat)
7801 sun.tools.jps.Jps (jps命令的进程)
2、查看java进程运行时参数命令jstat
官网链接:jstat官方文档
输入命令: jstat -gc 5376 1000 10 (查看gc的内存状态 1000ms查一次 查询10次)
kjctar@kjctar-virtual-machine:~/Downloads/apache-tomcat-8.5.50/bin$ jstat -gc 5376 1000 10
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
2560.0 2560.0 0.0 2544.0 31744.0 16132.0 42496.0 8638.6 15104.0 14619.0 1792.0 1578.0 3 0.179 0 0.000 0.179
2560.0 2560.0 0.0 2544.0 31744.0 16132.0 42496.0 8638.6 15104.0 14619.0 1792.0 1578.0 3 0.179 0 0.000 0.179
2560.0 2560.0 0.0 2544.0 31744.0 16132.0 42496.0 8638.6 15104.0 14619.0 1792.0 1578.0 3 0.179 0 0.000 0.179
2560.0 2560.0 0.0 2544.0 31744.0 16132.0 42496.0 8638.6 15104.0 14619.0 1792.0 1578.0 3 0.179 0 0.000 0.179
2560.0 2560.0 0.0 2544.0 31744.0 16132.0 42496.0 8638.6 15104.0 14619.0 1792.0 1578.0 3 0.179 0 0.000 0.179
2560.0 2560.0 0.0 2544.0 31744.0 16132.0 42496.0 8638.6 15104.0 14619.0 1792.0 1578.0 3 0.179 0 0.000 0.179
2560.0 2560.0 0.0 2544.0 31744.0 16132.0 42496.0 8638.6 15104.0 14619.0 1792.0 1578.0 3 0.179 0 0.000 0.179
2560.0 2560.0 0.0 2544.0 31744.0 16132.0 42496.0 8638.6 15104.0 14619.0 1792.0 1578.0 3 0.179 0 0.000 0.179
2560.0 2560.0 0.0 2544.0 31744.0 16132.0 42496.0 8638.6 15104.0 14619.0 1792.0 1578.0 3 0.179 0 0.000 0.179
2560.0 2560.0 0.0 2544.0 31744.0 16132.0 42496.0 8638.6 15104.0 14619.0 1792.0 1578.0 3 0.179 0 0.000 0.179
分析内存溢出
第一步 导出内存印象文件 (有两种方法)
- 自动导出:配置-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./
- 手动导出 命令
jmap -dump:format=b,file=heap.hprof 45458(进程id)
第二步,通过eclipes memory Analyser 分析内存印象
来源:CSDN
作者:Kjctar
链接:https://blog.csdn.net/qq_38570571/article/details/104091934