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 TestAllocIntArrays 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 * TestAllocIntArrays 34 * 35 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 36 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 37 * -XX:-ShenandoahDegeneratedGC -XX:+ShenandoahVerify 38 * TestAllocIntArrays 39 * 40 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 41 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 42 * -XX:+ShenandoahDegeneratedGC 43 * TestAllocIntArrays 44 * 45 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 46 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 47 * -XX:-ShenandoahDegeneratedGC 48 * TestAllocIntArrays 49 */ 50 51 /* 52 * @test TestAllocIntArrays 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 * TestAllocIntArrays 61 * 62 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 63 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 64 * -XX:+ShenandoahAllocFailureALot -XX:+ShenandoahVerify 65 * TestAllocIntArrays 66 * 67 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 68 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 69 * -XX:+ShenandoahOOMDuringEvacALot 70 * TestAllocIntArrays 71 * 72 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 73 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 74 * -XX:+ShenandoahAllocFailureALot 75 * TestAllocIntArrays 76 * 77 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 78 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 79 * TestAllocIntArrays 80 * 81 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 82 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive 83 * -XX:+ShenandoahVerify 84 * TestAllocIntArrays 85 * 86 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 87 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive 88 * TestAllocIntArrays 89 * 90 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 91 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static 92 * TestAllocIntArrays 93 * 94 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 95 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact 96 * TestAllocIntArrays 97 * 98 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 99 * -XX:+UseShenandoahGC 100 * -XX:-UseTLAB -XX:+ShenandoahVerify 101 * TestAllocIntArrays 102 */ 103 104 /* 105 * @test TestAllocIntArrays 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 * TestAllocIntArrays 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 * TestAllocIntArrays 119 * 120 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 121 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 122 * -XX:+ShenandoahOOMDuringEvacALot 123 * TestAllocIntArrays 124 * 125 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 126 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 127 * -XX:+ShenandoahAllocFailureALot 128 * TestAllocIntArrays 129 * 130 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 131 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive 132 * TestAllocIntArrays 133 * 134 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 135 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu 136 * -XX:+ShenandoahVerify 137 * TestAllocIntArrays 138 * 139 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g 140 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu 141 * TestAllocIntArrays 142 */ 143 144 import java.util.Random; 145 146 public class TestAllocIntArrays { 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 int[min + r.nextInt(max - min)]; 160 } 161 } 162 163 }