8076040: Test com/sun/crypto/provider/KeyFactory/TestProviderLeak.java fails with -XX:+UseG1GC
Reviewed-by: darcy
--- 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();