1 /* 2 * Copyright (c) 2017, 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 TestLotsOfCycles 27 * @key gc 28 * @requires vm.gc.Shenandoah & !vm.graal.enabled 29 * 30 * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 31 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 32 * -XX:+ShenandoahDegeneratedGC 33 * -Dtarget=10000 34 * TestLotsOfCycles 35 * 36 * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 37 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive 38 * -XX:-ShenandoahDegeneratedGC 39 * -Dtarget=10000 40 * TestLotsOfCycles 41 */ 42 43 /* 44 * @test TestLotsOfCycles 45 * @key gc 46 * @requires vm.gc.Shenandoah & !vm.graal.enabled 47 * 48 * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 49 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 50 * -XX:+ShenandoahOOMDuringEvacALot 51 * -Dtarget=1000 52 * TestLotsOfCycles 53 * 54 * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 55 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 56 * -XX:+ShenandoahAllocFailureALot 57 * -Dtarget=1000 58 * TestLotsOfCycles 59 * 60 * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 61 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive 62 * -Dtarget=1000 63 * TestLotsOfCycles 64 * 65 * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 66 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive 67 * -Dtarget=10000 68 * TestLotsOfCycles 69 * 70 * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 71 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static 72 * -Dtarget=10000 73 * TestLotsOfCycles 74 * 75 * @run main/othervm/timeout=480 -Xmx16m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions 76 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact 77 * -Dtarget=1000 78 * TestLotsOfCycles 79 */ 80 81 public class TestLotsOfCycles { 82 83 static final long TARGET_MB = Long.getLong("target", 10_000); // 10 Gb allocation, around 1K cycles to handle 84 static final long STRIDE = 100_000; 85 86 static volatile Object sink; 87 88 public static void main(String[] args) throws Exception { 89 long count = TARGET_MB * 1024 * 1024 / 16; 90 for (long c = 0; c < count; c += STRIDE) { 91 for (long s = 0; s < STRIDE; s++) { 92 sink = new Object(); 93 } 94 Thread.sleep(1); 95 } 96 } 97 98 }