< prev index next >

src/hotspot/share/prims/jvm.cpp

Print this page
rev 52426 : 8185496: Improve performance of system properties initialization in initPhase1
8213424: VersionProps duplicate and skipped initialization

@@ -363,26 +363,25 @@
   Handle props(THREAD, JNIHandles::resolve_non_null(properties));
 
   // System property list includes both user set via -D option and
   // jvm system specific properties.
   for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) {
+    if (strcmp(p->key(), "sun.nio.MaxDirectMemorySize") == 0)  // Can not be defined with -D
+      continue;
     PUTPROP(props, p->key(), p->value());
   }
 
   // Convert the -XX:MaxDirectMemorySize= command line flag
   // to the sun.nio.MaxDirectMemorySize property.
   // Do this after setting user properties to prevent people
   // from setting the value with a -D option, as requested.
-  {
-    if (FLAG_IS_DEFAULT(MaxDirectMemorySize)) {
-      PUTPROP(props, "sun.nio.MaxDirectMemorySize", "-1");
-    } else {
+  // Leave empty if not supplied
+  if (!FLAG_IS_DEFAULT(MaxDirectMemorySize)) {
       char as_chars[256];
       jio_snprintf(as_chars, sizeof(as_chars), JULONG_FORMAT, MaxDirectMemorySize);
       PUTPROP(props, "sun.nio.MaxDirectMemorySize", as_chars);
     }
-  }
 
   // JVM monitoring and management support
   // Add the sun.management.compiler property for the compiler's name
   {
 #undef CSIZE
< prev index next >