6689523: max heap calculation for compressed oops is off by MaxPermSize

Need to subtract MaxPermSize from the total heap size when determining whether compressed oops is turned on.

Reviewed-by: jmasa, jcoomes, kvn
This commit is contained in:
Coleen Phillimore 2008-04-29 19:31:29 -04:00
parent e6afe110b8
commit aee4bafd9b
3 changed files with 18 additions and 4 deletions

View file

@ -1125,6 +1125,11 @@ void Arguments::set_cms_and_parnew_gc_flags() {
}
}
inline uintx max_heap_for_compressed_oops() {
LP64_ONLY(return oopDesc::OopEncodingHeapMax - MaxPermSize - os::vm_page_size());
NOT_LP64(return DefaultMaxRAM);
}
bool Arguments::should_auto_select_low_pause_collector() {
if (UseAutoGCSelectPolicy &&
!FLAG_IS_DEFAULT(MaxGCPauseMillis) &&
@ -1169,7 +1174,7 @@ void Arguments::set_ergonomics_flags() {
// field offset to determine free list chunk markers.
// Check that UseCompressedOops can be set with the max heap size allocated
// by ergonomics.
if (!UseConcMarkSweepGC && MaxHeapSize <= (32*G - os::vm_page_size())) {
if (!UseConcMarkSweepGC && MaxHeapSize <= max_heap_for_compressed_oops()) {
if (FLAG_IS_DEFAULT(UseCompressedOops)) {
FLAG_SET_ERGO(bool, UseCompressedOops, true);
}
@ -1205,7 +1210,10 @@ void Arguments::set_parallel_gc_flags() {
if (FLAG_IS_DEFAULT(MaxHeapSize)) {
const uint64_t reasonable_fraction =
os::physical_memory() / DefaultMaxRAMFraction;
const uint64_t maximum_size = (uint64_t) DefaultMaxRAM;
const uint64_t maximum_size = (uint64_t)
(FLAG_IS_DEFAULT(DefaultMaxRAM) && UseCompressedOops ?
MIN2(max_heap_for_compressed_oops(), DefaultMaxRAM) :
DefaultMaxRAM);
size_t reasonable_max =
(size_t) os::allocatable_physical_memory(reasonable_fraction);
if (reasonable_max > maximum_size) {