1 /* 2 * Copyright (c) 2016, 2018, Red Hat, Inc. All rights reserved. 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 only, as 6 * published by the Free Software Foundation. 7 * 8 * This code is distributed in the hope that it will be useful, but WITHOUT 9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 * version 2 for more details (a copy is included in the LICENSE file that 12 * accompanied this code). 13 * 14 * You should have received a copy of the GNU General Public License version 15 * 2 along with this work; if not, write to the Free Software Foundation, 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 * 18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 * or visit www.oracle.com if you need additional information or have any 20 * questions. 21 * 22 */ 23 24 /* 25 * @test TestAllocObjectArrays 26 * @summary Acceptance tests: collector can withstand allocation 27 * @key gc 28 * @requires vm.gc.Shenandoah & !vm.graal.enabled 29 * 30 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 31 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 32 * -XX:+ShenandoahDegeneratedGC -XX:+ShenandoahVerify 33 * TestAllocObjectArrays 34 * 35 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 36 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 37 * -XX:-ShenandoahDegeneratedGC -XX:+ShenandoahVerify 38 * TestAllocObjectArrays 39 * 40 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 41 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 42 * -XX:+ShenandoahDegeneratedGC 43 * TestAllocObjectArrays 44 * 45 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 46 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 47 * -XX:-ShenandoahDegeneratedGC 48 * TestAllocObjectArrays 49 50 /* 51 * @test TestAllocObjectArrays 52 * @summary Acceptance tests: collector can withstand allocation 53 * @key gc 54 * @requires vm.gc.Shenandoah & !vm.graal.enabled 55 * 56 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 57 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 58 * -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify 59 * TestAllocObjectArrays 60 * 61 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 62 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 63 * -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify 64 * TestAllocObjectArrays 65 * 66 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 67 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 68 * -XX:+ShenandoahOOMDuringEvacALot 69 * TestAllocObjectArrays 70 * 71 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 72 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 73 * -XX:+ShenandoahAllocFailureALot 74 * TestAllocObjectArrays 75 * 76 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 77 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 78 * TestAllocObjectArrays 79 * 80 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 81 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive 82 * -XX:+ShenandoahVerify 83 * TestAllocObjectArrays 84 * 85 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 86 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive 87 * TestAllocObjectArrays 88 * 89 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 90 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static 91 * TestAllocObjectArrays 92 * 93 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 94 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact 95 * TestAllocObjectArrays 96 * 97 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 98 * -XX:+UseShenandoahGC 99 * -XX:-UseTLAB -XX:+ShenandoahVerify 100 * TestAllocObjectArrays 101 */ 102 103 /* 104 * @test TestAllocObjectArrays 105 * @summary Acceptance tests: collector can withstand allocation 106 * @key gc 107 * @requires vm.gc.Shenandoah & !vm.graal.enabled 108 * 109 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 110 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=traversal -XX:ShenandoahGCHeuristics=aggressive 111 * -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify 112 * TestAllocObjectArrays 113 * 114 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 115 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=traversal -XX:ShenandoahGCHeuristics=aggressive 116 * -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify 117 * TestAllocObjectArrays 118 * 119 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 120 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=traversal -XX:ShenandoahGCHeuristics=aggressive 121 * -XX:+ShenandoahOOMDuringEvacALot 122 * TestAllocObjectArrays 123 * 124 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 125 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=traversal -XX:ShenandoahGCHeuristics=aggressive 126 * -XX:+ShenandoahAllocFailureALot 127 * TestAllocObjectArrays 128 * 129 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 130 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=traversal -XX:ShenandoahGCHeuristics=aggressive 131 * TestAllocObjectArrays 132 * 133 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 134 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=traversal 135 * -XX:+ShenandoahVerify 136 * TestAllocObjectArrays 137 * 138 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 139 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=traversal 140 * TestAllocObjectArrays 141 */ 142 143 import java.util.Random; 144 145 public class TestAllocObjectArrays { 146 147 static final long TARGET_MB = Long.getLong("target", 10_000); // 10 Gb allocation 148 149 static volatile Object sink; 150 151 public static void main(String[] args) throws Exception { 152 final int min = 0; 153 final int max = 384 * 1024; 154 long count = TARGET_MB * 1024 * 1024 / (16 + 4 * (min + (max - min) / 2)); 155 156 Random r = new Random(); 157 for (long c = 0; c < count; c++) { 158 sink = new Object[min + r.nextInt(max - min)]; 159 } 160 } 161 162 }