當我用下面的配置上運行HotSpot虛擬機我的Java應用程序: -Xms2048m,-Xmx2048m,則JMAP輸出:Hotsot JVM選項
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
但是,當我添加anthor JVM選項-Xmn500m,則JMAP輸出似乎是合理的,即容量服從公式嚴格
我發現了與這個問題有關的源代碼。我認爲這可能會有所幫助。 [psYoungGen.cpp](https://github.com/JetBrains/jdk8u_hotspot/blob/master/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp)。從第108行到第144行 –