jdk/test/com/sun/crypto/provider/KeyFactory/TestProviderLeak.java
changeset 31473 650c75fa6728
parent 31472 850f01aa6a87
child 40449 5fbe26f13a4e
equal deleted inserted replaced
31472:850f01aa6a87 31473:650c75fa6728
    65             try {
    65             try {
    66                 megaByte = new byte [MB];
    66                 megaByte = new byte [MB];
    67                 data.add(megaByte);
    67                 data.add(megaByte);
    68             } catch (OutOfMemoryError e) {
    68             } catch (OutOfMemoryError e) {
    69                 megaByte = null;    // Free memory ASAP
    69                 megaByte = null;    // Free memory ASAP
    70                 System.out.println("OOME is thrown when allocating "
    70 
    71                         + data.size() + "MB memory.");
    71                 int size = data.size();
    72 
    72 
    73                 for (int j = 0; j < RESERVATION && !data.isEmpty(); j++) {
    73                 for (int j = 0; j < RESERVATION && !data.isEmpty(); j++) {
    74                     data.removeLast();
    74                     data.removeLast();
    75                 }
    75                 }
    76                 System.gc();
    76                 System.gc();
    77                 hasException = true;
    77                 hasException = true;
       
    78                 System.out.println("OOME is thrown when allocating "
       
    79                         + size + "MB memory.");
    78             }
    80             }
    79         }
    81         }
    80         dumpMemoryStats("After memory allocation");
    82         dumpMemoryStats("After memory allocation");
    81 
    83 
    82         return data;
    84         return data;