JVM小知识:linux 命令查看jvm堆内存信息

2023-05-16

1.查看当前java进程的pid

	pgrep -lf java

在这里插入图片描述
2.查看java堆的详细信息

	jmap -heap PID 

在这里插入图片描述
3.查看java堆中对象的相关信息,包含数量以及占用的空间大小

	jmap -histo PID 

在这里插入图片描述
4.查看监控 heap size 和 jvm垃圾回收情况,尤其是gc情况的监控,如果老年代发生full gc,那么很可能会导致内存泄漏的可能性

	jstat -gcutil pid

在这里插入图片描述
属性参照:

S0: Survivor 0区的空间使用率 Survivor space 0 utilization as a percentage of the space's current capacity.

S1: Survivor 1区的空间使用率 Survivor space 1 utilization as a percentage of the space's current capacity.

E: Eden区的空间使用率 Eden space utilization as a percentage of the space's current capacity.

O: 老年代的空间使用率 Old space utilization as a percentage of the space's current capacity.

M: 元数据的空间使用率 Metaspace utilization as a percentage of the space's current capacity.

CCS: 类指针压缩空间使用率 Compressed class space utilization as a percentage.

YGC: 新生代GC次数 Number of young generation GC events.

YGCT: 新生代GC总时长(从应用程序启动到采样时年轻代中gc所用时间 单位:s)
	  Young generation garbage collection time.

FGC: Full GC次数 Number of full GC events.

FGCT: Full GC总时长(从应用程序启动到采样时old代(全gc)gc所用时间 单位:s)
	  Full garbage collection time.

GCT: 总共的GC时长 (从应用程序启动到采样时gc用的总时间 单位:s)Total garbage collection time.

注:full gc很具有代表性,full gc次数 和时间 指标很能显示系统性能问题,这两个指标很大,很大程度上说明了程序中有问题,垃圾一直回收不掉




*觉得有用可以关注博主哦,如果再不能相遇,祝你早午晚都安。。。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

JVM小知识:linux 命令查看jvm堆内存信息 的相关文章

随机推荐