test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java
changeset 51558 a50648f7b1c8
parent 48835 62004f705d27
child 55283 4556dd808daa
child 58678 9cf78a70fa4f
--- a/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java	Tue Aug 28 16:01:01 2018 -0700
+++ b/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java	Tue Aug 28 16:01:12 2018 -0700
@@ -34,6 +34,7 @@
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.dcmd.CommandExecutor;
 import jdk.test.lib.dcmd.JMXExecutor;
+import jdk.test.lib.Platform;
 import sun.tools.attach.HotSpotVirtualMachine;
 
 import static optionsvalidation.JVMOptionsUtils.failedMessage;
@@ -384,6 +385,17 @@
             runJava.add(VMType);
         }
 
+        // Run with a small heap to avoid excessive execution time
+        long max = Runtime.getRuntime().maxMemory() / 1024 / 1024;
+        if (max > 1024) {
+            runJava.add("-Xmx1024m");
+        }
+
+        if (Platform.isDebugBuild()) {
+            // Avoid excessive execution time.
+            runJava.add("-XX:-ZapUnusedHeapArea");
+        }
+
         if (GCType != null &&
             !(prepend.contains("-XX:+UseConcMarkSweepGC") ||
               prepend.contains("-XX:+UseSerialGC") ||