diff --git a/src/share/vm/memory/collectorPolicy.cpp b/src/share/vm/memory/collectorPolicy.cpp index b8e4ab35df60b7f74f8f81a2eb337513aa0a7e78..c6b8e3875e47c7cbf76c122f9a6b830c14ce0639 100644 --- a/src/share/vm/memory/collectorPolicy.cpp +++ b/src/share/vm/memory/collectorPolicy.cpp @@ -32,7 +32,11 @@ void CollectorPolicy::initialize_flags() { MaxPermSize = PermSize; } PermSize = MAX2(min_alignment(), align_size_down_(PermSize, min_alignment())); - MaxPermSize = align_size_up(MaxPermSize, max_alignment()); + // Don't increase Perm size limit above specified. + MaxPermSize = align_size_down(MaxPermSize, max_alignment()); + if (PermSize > MaxPermSize) { + PermSize = MaxPermSize; + } MinPermHeapExpansion = MAX2(min_alignment(), align_size_down_(MinPermHeapExpansion, min_alignment())); MaxPermHeapExpansion = MAX2(min_alignment(), align_size_down_(MaxPermHeapExpansion, min_alignment())); diff --git a/src/share/vm/runtime/arguments.cpp b/src/share/vm/runtime/arguments.cpp index b70be1b73a32c2d426c05fc60cebcfba3ae2cedd..ec7210870e31c150e534c1c90e273701a14c58ed 100644 --- a/src/share/vm/runtime/arguments.cpp +++ b/src/share/vm/runtime/arguments.cpp @@ -1273,7 +1273,8 @@ bool verify_object_alignment() { } inline uintx max_heap_for_compressed_oops() { - LP64_ONLY(return OopEncodingHeapMax - MaxPermSize - os::vm_page_size()); + // Heap should be above HeapBaseMinAddress to get zero based compressed oops. + LP64_ONLY(return OopEncodingHeapMax - MaxPermSize - os::vm_page_size() - HeapBaseMinAddress); NOT_LP64(ShouldNotReachHere(); return 0); }