现在 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 而已
这方面没有经验,有没有大佬指点一下,内存到底跑哪去了呢。
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.