1 /* 2 * Copyright (c) 2016, 2018, Red Hat, Inc. 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 /* 26 * @test TestAllocObjectArrays 27 * @summary Acceptance tests: collector can withstand allocation 28 * @key gc 29 * @requires vm.gc.Shenandoah & !vm.graal.enabled 30 * 31 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 32 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 33 * -XX:+ShenandoahDegeneratedGC -XX:+ShenandoahVerify 34 * TestAllocObjectArrays 35 * 36 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 37 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 38 * -XX:-ShenandoahDegeneratedGC -XX:+ShenandoahVerify 39 * TestAllocObjectArrays 40 * 41 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 42 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 43 * -XX:+ShenandoahDegeneratedGC 44 * TestAllocObjectArrays 45 * 46 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 47 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 48 * -XX:-ShenandoahDegeneratedGC 49 * TestAllocObjectArrays 50 51 /* 52 * @test TestAllocObjectArrays 53 * @summary Acceptance tests: collector can withstand allocation 54 * @key gc 55 * @requires vm.gc.Shenandoah & !vm.graal.enabled 56 * 57 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 58 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 59 * -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify 60 * TestAllocObjectArrays 61 * 62 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 63 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 64 * -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify 65 * TestAllocObjectArrays 66 * 67 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 68 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 69 * -XX:+ShenandoahOOMDuringEvacALot 70 * TestAllocObjectArrays 71 * 72 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 73 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 74 * -XX:+ShenandoahAllocFailureALot 75 * TestAllocObjectArrays 76 * 77 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 78 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 79 * TestAllocObjectArrays 80 * 81 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 82 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive 83 * -XX:+ShenandoahVerify 84 * TestAllocObjectArrays 85 * 86 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 87 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive 88 * TestAllocObjectArrays 89 * 90 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 91 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static 92 * TestAllocObjectArrays 93 * 94 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 95 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact 96 * TestAllocObjectArrays 97 * 98 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 99 * -XX:+UseShenandoahGC 100 * -XX:-UseTLAB -XX:+ShenandoahVerify 101 * TestAllocObjectArrays 102 */ 103 104 /* 105 * @test TestAllocObjectArrays 106 * @summary Acceptance tests: collector can withstand allocation 107 * @key gc 108 * @requires vm.gc.Shenandoah & !vm.graal.enabled 109 * 110 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 111 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 112 * -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify 113 * TestAllocObjectArrays 114 * 115 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 116 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 117 * -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify 118 * TestAllocObjectArrays 119 * 120 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 121 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 122 * -XX:+ShenandoahOOMDuringEvacALot 123 * TestAllocObjectArrays 124 * 125 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 126 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 127 * -XX:+ShenandoahAllocFailureALot 128 * TestAllocObjectArrays 129 * 130 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 131 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 132 * TestAllocObjectArrays 133 * 134 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 135 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu 136 * -XX:+ShenandoahVerify 137 * TestAllocObjectArrays 138 * 139 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 140 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu 141 * TestAllocObjectArrays 142 */ 143 144 import java.util.Random; 145 146 public class TestAllocObjectArrays { 147 148 static final long TARGET_MB = Long.getLong("target", 10_000); // 10 Gb allocation 149 150 static volatile Object sink; 151 152 public static void main(String[] args) throws Exception { 153 final int min = 0; 154 final int max = 384 * 1024; 155 long count = TARGET_MB * 1024 * 1024 / (16 + 4 * (min + (max - min) / 2)); 156 157 Random r = new Random(); 158 for (long c = 0; c < count; c++) { 159 sink = new Object[min + r.nextInt(max - min)]; 160 } 161 } 162 163 }