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