Skip to content
Browse files
8262326: MaxMetaspaceSize does not have to be aligned to metaspace co…
…mmit alignment

Reviewed-by: coleenp, iklam
  • Loading branch information
tstuefe committed Mar 15, 2021
1 parent d825198 commit 189289d9c71c520e41ee696a08a1c4defa458aa8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
@@ -607,9 +607,8 @@ void Metaspace::ergo_initialize() {
// to commit for the Metaspace.
// It is just a number; a limit we compare against before committing. It
// does not have to be aligned to anything.
// It gets used as compare value in class CommitLimiter.
// It is set to max_uintx in globals.hpp by default, so by default it does
// not limit anything.
// It gets used as compare value before attempting to increase the metaspace
// commit charge. It defaults to max_uintx (unlimited).
// CompressedClassSpaceSize is the size, in bytes, of the address range we
// pre-reserve for the compressed class space (if we use class space).
@@ -626,8 +625,7 @@ void Metaspace::ergo_initialize() {
// We still adjust CompressedClassSpaceSize to reasonable limits, mainly to
// save on reserved space, and to make ergnonomics less confusing.

// (aligned just for cleanliness:)
MaxMetaspaceSize = MAX2(align_down(MaxMetaspaceSize, commit_alignment()), commit_alignment());
MaxMetaspaceSize = MAX2(MaxMetaspaceSize, commit_alignment());

if (UseCompressedClassPointers) {
// Let CCS size not be larger than 80% of MaxMetaspaceSize. Note that is
@@ -96,10 +96,7 @@ static void print_vs(outputStream* out, size_t scale) {

static void print_settings(outputStream* out, size_t scale) {
out->print("MaxMetaspaceSize: ");
// See Metaspace::ergo_initialize() for how MaxMetaspaceSize is rounded
if (MaxMetaspaceSize >= align_down(max_uintx, Metaspace::commit_alignment())) {
// aka "very big". Default is max_uintx, but due to rounding in arg parsing the real
// value is smaller.
if (MaxMetaspaceSize == max_uintx) {
} else {
print_human_readable_size(out, MaxMetaspaceSize, scale);

0 comments on commit 189289d

Please sign in to comment.