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