为什么“来自太空”和“太空”在jvm中不相等

问题描述 投票:0回答:1
  • 环境:jdk8u101
  • os:centos6
  • 描述:“从空间”和“到空间”不等于堆的伊甸园。在我看来,“从太空”到“太空”使用复制算法,它们的空间总是保持相等。
  • 有人能帮我吗?
  • 我无法粘贴截图,因此我将主要数据粘贴在下面

[root@05c46b9d1fc1 /]# jmap -heap 1
Attaching to process ID 1, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.101-b13

using thread-local object allocation.
Parallel GC with 33 thread(s)
Heap Configuration:
   MinHeapFreeRatio         = 0
   MaxHeapFreeRatio         = 100
   MaxHeapSize              = 4294967296 (4096.0MB)
   NewSize                  = 357564416 (341.0MB)
   MaxNewSize               = 1431306240 (1365.0MB)
   OldSize                  = 716177408 (683.0MB)
   NewRatio                 = 2
   SurvivorRatio            = 8
   MetaspaceSize            = 21807104 (20.796875MB)
   CompressedClassSpaceSize = 1073741824 (1024.0MB)
   MaxMetaspaceSize         = 17592186044415 MB
   G1HeapRegionSize         = 0 (0.0MB)

Heap Usage:
PS Young Generation
Eden Space:
   capacity = 342360064 (326.5MB)
   used     = 251910632 (240.2406997680664MB)
   free     = 90449432 (86.2593002319336MB)
   73.58061248639093% used
From Space:
   capacity = 23068672 (22.0MB)
   used     = 0 (0.0MB)
   free     = 23068672 (22.0MB)
   0.0% used
To Space:
   capacity = 44564480 (42.5MB)
   used     = 0 (0.0MB)
   free     = 44564480 (42.5MB)
   0.0% used
PS Old Generation
   capacity = 763363328 (728.0MB)
   used     = 26507512 (25.27953338623047MB)
   free     = 736855816 (702.7204666137695MB)
   3.47246337722946% used
java jvm jvm-hotspot
1个回答
0
投票

假设堆正在增长(因为您的工作集正在增长),那么JVM将保持新空间大小与旧空间大小的比率相同。要做到这一点,它需要分配一个大的“to”空间而不是“from”空间。

为了详细了解JVM如何计算空间大小,我建议您下载并仔细研究您想要了解的OpenJDK特定版本(发行版和补丁)的源代码。

© www.soinside.com 2019 - 2024. All rights reserved.