jvm将ClassSpaceSize压缩到1GB以上,如何更好地分析使用了这么多空间的内容?

wbgh16ku  于 2021-06-30  发布在  Java
关注(0)|答案(0)|浏览(194)

我试图了解jvm的总内存使用量和潜在的非堆内存泄漏。
在aws ec2虚拟机上,进程需要1.9 gb,只有1 gb。我们将jvm最大堆内存限制为512MB。

CompressedClassSpaceSize = 1073741824 (1024.0MB)

我不认为我们使用那么多的.jar库来构成1GB。
有什么办法能让我们更清楚地了解这件事吗?在当前运行的jvm上?或者用某种方法重新开始追踪?
在我们的系统中,有一件事我们做得很独特:我们使用classloader#getresource从类路径加载大量资源。。。我想知道这是不是导致增长的原因?
细节:

$ jcmd 94084 GC.heap_info
94084:
 def new generation   total 23552K, used 19966K [0x0000000812000000, 0x0000000813980000, 0x000000081caa0000)
  eden space 20992K,  88% used [0x0000000812000000, 0x000000081323c850, 0x0000000813480000)
  from space 2560K,  50% used [0x0000000813700000, 0x0000000813843090, 0x0000000813980000)
  to   space 2560K,   0% used [0x0000000813480000, 0x0000000813480000, 0x0000000813700000)
 tenured generation   total 52064K, used 31236K [0x000000081caa0000, 0x000000081fd78000, 0x0000000832000000)
   the space 52064K,  59% used [0x000000081caa0000, 0x000000081e9213c8, 0x000000081e921400, 0x000000081fd78000)
 Metaspace       used 38523K, capacity 38938K, committed 39296K, reserved 1085440K
  class space    used 4029K, capacity 4147K, committed 4224K, reserved 1048576K

$ jmap -heap 94084
Attaching to process ID 94084, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.265-b01

using thread-local object allocation.
Mark Sweep Compact GC

Heap Configuration:
   MinHeapFreeRatio         = 40
   MaxHeapFreeRatio         = 70
   MaxHeapSize              = 536870912 (512.0MB)
   NewSize                  = 5570560 (5.3125MB)
   MaxNewSize               = 178913280 (170.625MB)
   OldSize                  = 11206656 (10.6875MB)
   NewRatio                 = 2
   SurvivorRatio            = 8
   MetaspaceSize            = 21807104 (20.796875MB)
   CompressedClassSpaceSize = 1073741824 (1024.0MB)
   MaxMetaspaceSize         = 17592186044415 MB
   G1HeapRegionSize         = 0 (0.0MB)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题