Mon, 29 Apr 2013 16:13:57 -0400
8011773: Some tests on Interned String crashed JVM with OOM
Summary: Instead of terminating the VM, throw OutOfMemoryError exceptions.
Reviewed-by: coleenp, dholmes
never@1254 | 1 | /* |
trims@1907 | 2 | * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. |
never@1254 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
never@1254 | 4 | * |
never@1254 | 5 | * This code is free software; you can redistribute it and/or modify it |
never@1254 | 6 | * under the terms of the GNU General Public License version 2 only, as |
never@1254 | 7 | * published by the Free Software Foundation. |
never@1254 | 8 | * |
never@1254 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
never@1254 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
never@1254 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
never@1254 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
never@1254 | 13 | * accompanied this code). |
never@1254 | 14 | * |
never@1254 | 15 | * You should have received a copy of the GNU General Public License version |
never@1254 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
never@1254 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
never@1254 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
never@1254 | 22 | * |
never@1254 | 23 | */ |
never@1254 | 24 | |
never@1254 | 25 | /** |
never@1254 | 26 | * @test |
never@1254 | 27 | * @bug 6849574 |
never@1254 | 28 | * @summary VM crash using NonBlockingHashMap (high_scale_lib) |
never@1254 | 29 | * |
never@1254 | 30 | * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+VerifyBeforeGC Test |
never@1254 | 31 | */ |
never@1254 | 32 | |
never@1254 | 33 | import java.util.concurrent.atomic.*; |
never@1254 | 34 | |
never@1254 | 35 | public class Test extends Thread { |
never@1254 | 36 | |
never@1254 | 37 | public static void main(String[] args) { |
never@1254 | 38 | AtomicReferenceArray a = new AtomicReferenceArray(10000); |
never@1254 | 39 | for (int i = 0; i < 100000; i++) { |
never@1254 | 40 | a.getAndSet(9999, new Object()); |
never@1254 | 41 | if (i > 99990) System.gc(); |
never@1254 | 42 | } |
never@1254 | 43 | } |
never@1254 | 44 | } |