United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6689523 max heap calculation for compressed oops is off by MaxPermSize
JDK-6689523 : max heap calculation for compressed oops is off by MaxPermSize

Details
Type:
Bug
Submit Date:
2008-04-16
Status:
Closed
Updated Date:
2011-02-15
Project Name:
JDK
Resolved Date:
2011-02-15
Component:
hotspot
OS:
generic
Sub-Component:
runtime
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs13
Fixed Versions:
hs13 (b01)

Related Reports
Backport:
Backport:

Sub Tasks

Description
The max size for UseCompressedOops didn't realize that perm gen isn't included in MaxHeapSize, so needs to be fixed.

                                    

Comments
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;
                                     
2008-04-16
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
                                     
2008-04-30



Hardware and Software, Engineered to Work Together