diff options
author | ehelin <none@none> | 2013-10-01 15:21:14 +0200 |
---|---|---|
committer | ehelin <none@none> | 2013-10-01 15:21:14 +0200 |
commit | 17d455b48b9efa79df91ed89499b6de61668fe30 (patch) | |
tree | bcba5f1f5fff562b56fcbd620e141737cf183547 /src/share/vm/memory/collectorPolicy.cpp | |
parent | 03be91c0cc24d22da281c33754858cc474f428cb (diff) |
8025313: MetaspaceMemoryPool incorrectly reports undefined size for max
Reviewed-by: stefank, tschatzl
--HG--
extra : rebase_source : 09d641fdddcb1f1c45dd8878c5cc50eecfa0a28f
Diffstat (limited to 'src/share/vm/memory/collectorPolicy.cpp')
-rw-r--r-- | src/share/vm/memory/collectorPolicy.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/share/vm/memory/collectorPolicy.cpp b/src/share/vm/memory/collectorPolicy.cpp index 0728997b7..283db680b 100644 --- a/src/share/vm/memory/collectorPolicy.cpp +++ b/src/share/vm/memory/collectorPolicy.cpp @@ -64,19 +64,21 @@ void CollectorPolicy::initialize_flags() { vm_exit_during_initialization("Incompatible initial and maximum heap sizes specified"); } - if (!is_size_aligned(MaxMetaspaceSize, max_alignment())) { - FLAG_SET_ERGO(uintx, MaxMetaspaceSize, - restricted_align_down(MaxMetaspaceSize, max_alignment())); - } + // Do not use FLAG_SET_ERGO to update MaxMetaspaceSize, since this will + // override if MaxMetaspaceSize was set on the command line or not. + // This information is needed later to conform to the specification of the + // java.lang.management.MemoryUsage API. + // + // Ideally, we would be able to set the default value of MaxMetaspaceSize in + // globals.hpp to the aligned value, but this is not possible, since the + // alignment depends on other flags being parsed. + MaxMetaspaceSize = restricted_align_down(MaxMetaspaceSize, max_alignment()); if (MetaspaceSize > MaxMetaspaceSize) { - FLAG_SET_ERGO(uintx, MetaspaceSize, MaxMetaspaceSize); + MetaspaceSize = MaxMetaspaceSize; } - if (!is_size_aligned(MetaspaceSize, min_alignment())) { - FLAG_SET_ERGO(uintx, MetaspaceSize, - restricted_align_down(MetaspaceSize, min_alignment())); - } + MetaspaceSize = restricted_align_down(MetaspaceSize, min_alignment()); assert(MetaspaceSize <= MaxMetaspaceSize, "Must be"); |