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