现在 JVM 在 TOP 里面占用了 969MB,担心哪一天内存不够用了,想排查一下。
6033 root 20 0 4839404 992584 9932 S 0.3 51.7 9:59.60 java
然后看了下 jmap
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 492830720 (470.0MB)
NewSize = 10485760 (10.0MB)
MaxNewSize = 164233216 (156.625MB)
OldSize = 20971520 (20.0MB)
NewRatio = 2
SurvivorRatio = 8
MetaspaceSize = 21807104 (20.796875MB)
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 17592186044415 MB
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 87752704 (83.6875MB)
used = 68565312 (65.38897705078125MB)
free = 19187392 (18.29852294921875MB)
78.13469998599702% used
Eden Space:
capacity = 78053376 (74.4375MB)
used = 63509624 (60.56749725341797MB)
free = 14543752 (13.870002746582031MB)
81.36691486605268% used
From Space:
capacity = 9699328 (9.25MB)
used = 5055688 (4.821479797363281MB)
free = 4643640 (4.428520202636719MB)
52.12410591744088% used
To Space:
capacity = 9699328 (9.25MB)
used = 0 (0.0MB)
free = 9699328 (9.25MB)
0.0% used
tenured generation:
capacity = 194756608 (185.734375MB)
used = 157623088 (150.3210906982422MB)
free = 37133520 (35.41328430175781MB)
80.93337094883066% used
27656 interned Strings occupying 2127192 bytes.
在 jstat -gc 里面看 Meta 区的占用 是 68M
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
9472.0 9472.0 0.0 0.0 76224.0 40490.7 190200.0 114119.8 70272.0 67888.9 8320.0 7522.7 923 9.428 26 4.113 13.540
发现实际上也就只用了 83.68+185.73+68 = 337.4 MB 而已
这方面没有经验,有没有大佬指点一下,内存到底跑哪去了呢。
1
lhx2008 OP 而且内存占用还一直很稳定
|
2
tachikomachann 2018-10-20 09:31:57 +08:00 via Android
看下 JVM 启动参数,启动时堆预先分配了多少
|
3
lhx2008 OP @tachikomachann 堆空间数据上面有显示,启动 xms 是 256M
|
4
aa6563679 2018-10-20 09:52:53 +08:00 via iPhone
jvm 就算 gc 后释放了大量内存进程的内存使用也不会缩减
|
6
huiyifyj 2018-10-20 10:33:57 +08:00 via Android
题外话,个人更喜欢 htop 看。
|
7
loveCoding 2018-10-20 11:42:06 +08:00
xms 限制的是堆内存
|