diff src/share/vm/runtime/arguments.cpp @ 6736:11fb740ce98f

7196103: NPG: Unable to allocate bit map for parallel garbage collection for the requested heap size Summary: Don't allocate huge class metaspace size by default on x64 Reviewed-by: stefank, jmasa, kvn
author coleenp
date Fri, 07 Sep 2012 16:42:25 -0400
parents da91efe96a93
children bc675e55b48c 9a86ddfc6c8f
line wrap: on
line diff
--- a/src/share/vm/runtime/arguments.cpp	Fri Sep 07 12:04:16 2012 -0400
+++ b/src/share/vm/runtime/arguments.cpp	Fri Sep 07 16:42:25 2012 -0400
@@ -1427,6 +1427,16 @@
     // if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) {
     //   FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true);
     // }
+    // Set the ClassMetaspaceSize to something that will not need to be
+    // expanded, since it cannot be expanded.
+    if (UseCompressedKlassPointers && FLAG_IS_DEFAULT(ClassMetaspaceSize)) {
+      // 100,000 classes seems like a good size, so 100M assumes around 1K
+      // per klass.   The vtable and oopMap is embedded so we don't have a fixed
+      // size per klass.   Eventually, this will be parameterized because it
+      // would also be useful to determine the optimal size of the
+      // systemDictionary.
+      FLAG_SET_ERGO(uintx, ClassMetaspaceSize, 100*M);
+    }
   }
   // Also checks that certain machines are slower with compressed oops
   // in vm_version initialization code.
@@ -1965,6 +1975,9 @@
 
   status = status && verify_object_alignment();
 
+  status = status && verify_min_value(ClassMetaspaceSize, 1*M,
+                                      "ClassMetaspaceSize");
+
   return status;
 }
 
@@ -2916,7 +2929,7 @@
                             (UseLargePages && FLAG_IS_CMDLINE(UseLargePages));
   if (cannot_share) {
     if (must_share) {
-        warning("disabling large pages%s"
+        warning("disabling large pages %s"
                 "because of %s", "" LP64_ONLY("and compressed oops "),
                 DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on");
         FLAG_SET_CMDLINE(bool, UseLargePages, false);