< prev index next >

src/share/vm/memory/metaspace.cpp

Print this page

        

@@ -3194,10 +3194,26 @@
 
   MinMetaspaceExpansion = align_size_down_bounded(MinMetaspaceExpansion, _commit_alignment);
   MaxMetaspaceExpansion = align_size_down_bounded(MaxMetaspaceExpansion, _commit_alignment);
 
   CompressedClassSpaceSize = align_size_down_bounded(CompressedClassSpaceSize, _reserve_alignment);
+
+  if (UseCompressedClassPointers) {
+    if ((InitialBootClassLoaderMetaspaceSize + CompressedClassSpaceSize)
+                                                          >= MaxMetaspaceSize) {
+      vm_exit_during_initialization(
+       "Sum of InitialBootClassLoaderMetaspaceSize and CompressedClassSpaceSize"
+       " should be less than MaxMetaspaceSize.");
+    }
+  } else {
+    if (InitialBootClassLoaderMetaspaceSize >= MaxMetaspaceSize) {
+      vm_exit_during_initialization(
+       "InitialBootClassLoaderMetaspaceSize should be less than"
+                                                        " MaxMetaspaceSize.");
+    }
+  }
+
   set_compressed_class_space_size(CompressedClassSpaceSize);
 }
 
 void Metaspace::global_initialize() {
   MetaspaceGC::initialize();
< prev index next >