8076040: Test com/sun/crypto/provider/KeyFactory/TestProviderLeak.java fails with -XX:+UseG1GC
authorweijun
Thu, 02 Jul 2015 09:19:42 +0800
changeset 31472 850f01aa6a87
parent 31471 ae27c6f1d8bf
child 31473 650c75fa6728
8076040: Test com/sun/crypto/provider/KeyFactory/TestProviderLeak.java fails with -XX:+UseG1GC Reviewed-by: darcy
jdk/test/com/sun/crypto/provider/KeyFactory/TestProviderLeak.java
--- a/jdk/test/com/sun/crypto/provider/KeyFactory/TestProviderLeak.java	Thu Jul 02 00:26:35 2015 +0300
+++ b/jdk/test/com/sun/crypto/provider/KeyFactory/TestProviderLeak.java	Thu Jul 02 09:19:42 2015 +0800
@@ -66,9 +66,9 @@
                 megaByte = new byte [MB];
                 data.add(megaByte);
             } catch (OutOfMemoryError e) {
+                megaByte = null;    // Free memory ASAP
                 System.out.println("OOME is thrown when allocating "
                         + data.size() + "MB memory.");
-                megaByte = null;
 
                 for (int j = 0; j < RESERVATION && !data.isEmpty(); j++) {
                     data.removeLast();