8073735: compiler/loopopts/CountedLoopProblem.java got OOME
authoriveresov
Tue, 24 Feb 2015 23:31:00 -0800
changeset 29343 cf560f960e85
parent 29342 a7f66737bf1d
child 29344 49ad0989c84f
child 29346 46bff23fc1a2
8073735: compiler/loopopts/CountedLoopProblem.java got OOME Summary: Ignore OOM in the test Reviewed-by: kvn
hotspot/test/compiler/loopopts/CountedLoopProblem.java
--- a/hotspot/test/compiler/loopopts/CountedLoopProblem.java	Tue Feb 24 17:14:29 2015 +0000
+++ b/hotspot/test/compiler/loopopts/CountedLoopProblem.java	Tue Feb 24 23:31:00 2015 -0800
@@ -36,18 +36,22 @@
     public static void main(String[] args) throws Exception {
         Random r = new Random(42);
         int x = 0;
-        StringBuilder sb = new StringBuilder();
-        for(int i = 0; i < 1000000; ++i) {
-            int v = Math.abs(r.nextInt());
-            sb.append('+').append(v).append('\n');
-            x += v;
-            // To trigger the problem we must OSR in the following loop
-            // To make the problem 100% reproducible run with -XX:-TieredCompilation -XX:OSROnlyBCI=62
-            while(x < 0) x += 1000000000;
-            sb.append('=').append(x).append('\n');
-        }
-        if (sb.toString().hashCode() != 0xaba94591) {
-            throw new Exception("Unexpected result");
+        try {
+            StringBuilder sb = new StringBuilder();
+            for(int i = 0; i < 1000000; ++i) {
+                int v = Math.abs(r.nextInt());
+                sb.append('+').append(v).append('\n');
+                x += v;
+                // To trigger the problem we must OSR in the following loop
+                // To make the problem 100% reproducible run with -XX:-TieredCompilation -XX:OSROnlyBCI=62
+                while(x < 0) x += 1000000000;
+                sb.append('=').append(x).append('\n');
+            }
+            if (sb.toString().hashCode() != 0xaba94591) {
+                throw new Exception("Unexpected result");
+            }
+        } catch(OutOfMemoryError e) {
+            // small heap, ignore
         }
     }
 }