Tue, 01 Oct 2013 15:21:14 +0200
8025313: MetaspaceMemoryPool incorrectly reports undefined size for max
Reviewed-by: stefank, tschatzl
src/share/vm/memory/collectorPolicy.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/memory/collectorPolicy.cpp Tue Oct 01 07:52:52 2013 +0200 1.2 +++ b/src/share/vm/memory/collectorPolicy.cpp Tue Oct 01 15:21:14 2013 +0200 1.3 @@ -64,19 +64,21 @@ 1.4 vm_exit_during_initialization("Incompatible initial and maximum heap sizes specified"); 1.5 } 1.6 1.7 - if (!is_size_aligned(MaxMetaspaceSize, max_alignment())) { 1.8 - FLAG_SET_ERGO(uintx, MaxMetaspaceSize, 1.9 - restricted_align_down(MaxMetaspaceSize, max_alignment())); 1.10 + // Do not use FLAG_SET_ERGO to update MaxMetaspaceSize, since this will 1.11 + // override if MaxMetaspaceSize was set on the command line or not. 1.12 + // This information is needed later to conform to the specification of the 1.13 + // java.lang.management.MemoryUsage API. 1.14 + // 1.15 + // Ideally, we would be able to set the default value of MaxMetaspaceSize in 1.16 + // globals.hpp to the aligned value, but this is not possible, since the 1.17 + // alignment depends on other flags being parsed. 1.18 + MaxMetaspaceSize = restricted_align_down(MaxMetaspaceSize, max_alignment()); 1.19 + 1.20 + if (MetaspaceSize > MaxMetaspaceSize) { 1.21 + MetaspaceSize = MaxMetaspaceSize; 1.22 } 1.23 1.24 - if (MetaspaceSize > MaxMetaspaceSize) { 1.25 - FLAG_SET_ERGO(uintx, MetaspaceSize, MaxMetaspaceSize); 1.26 - } 1.27 - 1.28 - if (!is_size_aligned(MetaspaceSize, min_alignment())) { 1.29 - FLAG_SET_ERGO(uintx, MetaspaceSize, 1.30 - restricted_align_down(MetaspaceSize, min_alignment())); 1.31 - } 1.32 + MetaspaceSize = restricted_align_down(MetaspaceSize, min_alignment()); 1.33 1.34 assert(MetaspaceSize <= MaxMetaspaceSize, "Must be"); 1.35