1 /*
2 * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /**
25 * @test TestSoftReferencesBehaviorOnOOME
26 * @key gc
27 * @summary Tests that all SoftReferences has been cleared at time of OOM.
28 * @library /testlibrary
29 * @build TestSoftReferencesBehaviorOnOOME
30 * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k
31 * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 128k 256k
32 * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 2k 32k 10
33 */
34 import com.oracle.java.testlibrary.Utils;
35 import java.lang.ref.SoftReference;
36 import java.util.LinkedList;
37 import java.util.Random;
38
39 public class TestSoftReferencesBehaviorOnOOME {
40
41 private static final Random rndGenerator = Utils.getRandomInstance();
42
43 public static void main(String[] args) {
44 int semiRefAllocFrequency = DEFAULT_FREQUENCY;
45 long minSize = DEFAULT_MIN_SIZE,
46 maxSize = DEFAULT_MAX_SIZE;
47
48 if ( args.length >= 3 ) {
|
1 /*
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /**
25 * @test TestSoftReferencesBehaviorOnOOME
26 * @key gc
27 * @summary Tests that all SoftReferences has been cleared at time of OOM.
28 * @library /testlibrary
29 * @ignore 8073669
30 * @build TestSoftReferencesBehaviorOnOOME
31 * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k
32 * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 128k 256k
33 * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 2k 32k 10
34 */
35 import com.oracle.java.testlibrary.Utils;
36 import java.lang.ref.SoftReference;
37 import java.util.LinkedList;
38 import java.util.Random;
39
40 public class TestSoftReferencesBehaviorOnOOME {
41
42 private static final Random rndGenerator = Utils.getRandomInstance();
43
44 public static void main(String[] args) {
45 int semiRefAllocFrequency = DEFAULT_FREQUENCY;
46 long minSize = DEFAULT_MIN_SIZE,
47 maxSize = DEFAULT_MAX_SIZE;
48
49 if ( args.length >= 3 ) {
|