EVALUATION
http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/ed52bcc32739
|
|
|
SUGGESTED FIX
Change G1CollectedHeap::max_capacity() to
size_t G1CollectedHeap::max_capacity() const {
return _g1_reserved.byte_size();
}
|
|
|
EVALUATION
The reason for this is that we return the committed size from method G1CollectedHeap::max_capacity(), instead of the reserved size:
size_t G1CollectedHeap::max_capacity() const {
return _g1_committed.byte_size();
}
|
|
|
SUGGESTED FIX
This is the behavior before (on my 2G Linux x86 laptop):
tonys-laptop:~> java -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -jar ~/Projects/MMTest/dist/MMTest.jar
max memory = 33554432
tonys-laptop:~> java -Xms32m -Xmx128m -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -jar ~/Projects/MMTest/dist/MMTest.jar
max memory = 33554432
This is the behavior after, which seems correct:
tonys-laptop:~> java -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -jar ~/Projects/MMTest/dist/MMTest.jar
max memory = 524288000
tonys-laptop:~> java -Xms32m -Xmx128m -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -jar ~/Projects/MMTest/dist/MMTest.jarVM
max memory = 134217728
This is the same app with ParallelScavenge:
tonys-laptop:~> java -jar ~/Projects/MMTest/dist/MMTest.jar
max memory = 504889344
tonys-laptop:~> java -Xms32m -Xmx128m -jar ~/Projects/MMTest/dist/MMTest.jar
max memory = 129302528
This is slightly different to what G1 returns, because ParallelScavenge subtracts the space of the unused survivor from the reserved size. We won't do that in G1.
|
|
|
SUGGESTED FIX
I'll piggyback a very minor cosmetic change in g1MemoryPool.{hpp,cpp} on this CR.
|
|
|