当我使用以下配置在Hotspot VM上运行我的Java应用程序时: -Xms2048m , -Xmx2048m , jmap 输出:
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 2147483648 (2048.0MB)
NewSize = 1310720 (1.25MB)
MaxNewSize = 17592186044415 MB
OldSize = 5439488 (5.1875MB)
NewRatio = 2
SurvivorRatio = 8
PermSize = 21757952 (20.75MB)
MaxPermSize = 85983232 (82.0MB)
Heap Usage:
PS Young Generation
Eden Space:
capacity = 706740224 (674.0MB)
used = 364788568 (347.88948822021484MB)
free = 341951656 (326.11051177978516MB)
51.61565107124849% used
From Space:
capacity = 4587520 (4.375MB)
used = 1900560 (1.8125152587890625MB)
free = 2686960 (2.5624847412109375MB)
41.428920200892854% used
To Space:
capacity = 4456448 (4.25MB)
used = 0 (0.0MB)
free = 4456448 (4.25MB)
0.0% used
...
让我困惑的是为什么伊甸园空间和两个幸存者空间的能力不遵守公式
eden/(s0+s1) = SurvivorRatio
但是当我添加另一个jvm选项 -Xmn500m 时, jmap 输出似乎是合理的,即容量严格遵守公式