JDK-6689523 : max heap calculation for compressed oops is off by MaxPermSize
Type:Bug
Component:hotspot
Sub-Component:runtime
Affected Version:hs13
Priority:P4
Status:Closed
Resolution:Fixed
OS:generic
CPU:generic
Submitted:2008-04-16
Updated:2011-02-15
Resolved:2011-02-15
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
The max size for UseCompressedOops didn't realize that perm gen isn't included in MaxHeapSize, so needs to be fixed.
Comments
EVALUATION
6689523: max heap calculation for compressed oops is off by MaxPermSize
Summary: Need to subtract MaxPermSize from the total heap size when determining
whether compressed oops is turned on.
Reviewed-by: jmasa, jcoomes, kvn
30-04-2008
SUGGESTED FIX
src/share/vm/runtime/arguments.cpp
Print this page
*** 1123,1132 ****
--- 1123,1140 ----
"for the CMS collector. CMSParPromoteBlocksToClaim will take precedence.\n");
}
}
}
+ unsigned long max_heap_for_compressed_oops() {
+ #ifdef _LP64
+ return 32*G - MaxPermSize - os::vm_page_size();
+ #else
+ return DefaultMaxRAM;
+ #endif // _LP64
+ }
+
bool Arguments::should_auto_select_low_pause_collector() {
if (UseAutoGCSelectPolicy &&
!FLAG_IS_DEFAULT(MaxGCPauseMillis) &&
(MaxGCPauseMillis <= AutoGCSelectPauseMillis)) {
if (PrintGCDetails) {
*** 1167,1177 ****
#ifdef _LP64
// Compressed Headers do not work with CMS, which uses a bit in the klass
// 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 (FLAG_IS_DEFAULT(UseCompressedOops)) {
FLAG_SET_ERGO(bool, UseCompressedOops, true);
}
} else {
if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) {
--- 1175,1185 ----
#ifdef _LP64
// Compressed Headers do not work with CMS, which uses a bit in the klass
// 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 <= max_heap_for_compressed_oops()) {
if (FLAG_IS_DEFAULT(UseCompressedOops)) {
FLAG_SET_ERGO(bool, UseCompressedOops, true);
}
} else {
if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) {
*** 1203,1213 ****
Abstract_VM_Version::parallel_worker_threads());
if (FLAG_IS_DEFAULT(MaxHeapSize)) {
const uint64_t reasonable_fraction =
os::physical_memory() / DefaultMaxRAMFraction;
! const uint64_t maximum_size = (uint64_t) DefaultMaxRAM;
size_t reasonable_max =
(size_t) os::allocatable_physical_memory(reasonable_fraction);
if (reasonable_max > maximum_size) {
reasonable_max = maximum_size;
}
--- 1211,1224 ----
Abstract_VM_Version::parallel_worker_threads());
if (FLAG_IS_DEFAULT(MaxHeapSize)) {
const uint64_t reasonable_fraction =
os::physical_memory() / DefaultMaxRAMFraction;
! const uint64_t maximum_size = (uint64_t)
! (FLAG_IS_DEFAULT(DefaultMaxRAM) ?
! 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) {
reasonable_max = maximum_size;