8166046: [TESTBUG] compiler/stringopts/TestStringObjectInitialization.java fails with OOME
authorthartmann
Wed, 21 Sep 2016 08:14:46 +0200
changeset 41332 a1ff82a6136a
parent 41331 ec5e0ea52c77
child 41333 ce08d64b41c7
8166046: [TESTBUG] compiler/stringopts/TestStringObjectInitialization.java fails with OOME Summary: Reduced heap memory consumption of test. Reviewed-by: kvn
hotspot/test/compiler/stringopts/TestStringObjectInitialization.java
--- a/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java	Tue Sep 20 16:50:37 2016 -0700
+++ b/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java	Wed Sep 21 08:14:46 2016 +0200
@@ -67,6 +67,11 @@
         add(s + Arrays.toString(sArray) + " const ");
     }
 
+    public void reset() {
+        // Reset string to avoid OOMEs
+        myString = "";
+    }
+
     private static class Runner implements Runnable {
         private TestStringObjectInitialization test;
 
@@ -76,8 +81,9 @@
 
         public void run() {
             String[] array = {"a", "b", "c"};
-            for (int i = 0; i < 10000; ++i) {
+            for (int i = 0; i < 100_000; ++i) {
                 test.run("a", array);
+                test.reset();
             }
         }
     }