8080084: java/awt/Graphics2D/DrawString/DrawStringCrash.java fails with G1 GC
authorprr
Tue, 10 Oct 2017 12:15:25 -0700
changeset 47383 74429839ae97
parent 47382 6dff69a7fecc
child 47384 3b244a98d5ab
8080084: java/awt/Graphics2D/DrawString/DrawStringCrash.java fails with G1 GC Reviewed-by: ssadetsky, pnarayanan
test/jdk/java/awt/Graphics2D/DrawString/DrawStringCrash.java
--- a/test/jdk/java/awt/Graphics2D/DrawString/DrawStringCrash.java	Tue Oct 10 09:10:43 2017 -0700
+++ b/test/jdk/java/awt/Graphics2D/DrawString/DrawStringCrash.java	Tue Oct 10 12:15:25 2017 -0700
@@ -23,8 +23,9 @@
 
 /*
  * @test
- * @bug 8043508
+ * @bug 8043508 8080084
  * @summary Drawing a very long string crashes VM
+ * @run main/othervm DrawStringCrash
  */
 
 import java.awt.*;
@@ -53,11 +54,11 @@
         while (len < maxLen) {
             try {
                 g2d.drawString(sb.toString(), 20, 20);
+                sb.append(sb);
+                len *= 2;
             } catch (OutOfMemoryError e) {
                 return;
             }
-            sb.append(sb);
-            len *= 2;
         }
         return;
     }