Path: blob/master/test/hotspot/jtreg/gc/shenandoah/TestRetainObjects.java
40942 views
/*1* Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 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 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324/*25* @test TestRetainObjects26* @summary Acceptance tests: collector can deal with retained objects27* @requires vm.gc.Shenandoah28*29* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions30* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive31* -XX:+ShenandoahDegeneratedGC -XX:+ShenandoahVerify32* TestRetainObjects33*34* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions35* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive36* -XX:-ShenandoahDegeneratedGC -XX:+ShenandoahVerify37* TestRetainObjects38*39* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions40* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive41* -XX:+ShenandoahDegeneratedGC42* TestRetainObjects43*44* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions45* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive46* -XX:-ShenandoahDegeneratedGC47* TestRetainObjects48*/4950/*51* @test TestRetainObjects52* @summary Acceptance tests: collector can deal with retained objects53* @requires vm.gc.Shenandoah54*55* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions56* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive57* -XX:+ShenandoahOOMDuringEvacALot58* TestRetainObjects59*60* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions61* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive62* -XX:+ShenandoahAllocFailureALot63* TestRetainObjects64*65* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions66* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive67* TestRetainObjects68*/6970/*71* @test TestRetainObjects72* @summary Acceptance tests: collector can deal with retained objects73* @requires vm.gc.Shenandoah74*75* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions76* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive77* -XX:+ShenandoahVerify78* TestRetainObjects79*80* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions81* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive82* TestRetainObjects83*/8485/*86* @test TestRetainObjects87* @summary Acceptance tests: collector can deal with retained objects88* @requires vm.gc.Shenandoah89*90* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions91* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static92* TestRetainObjects93*/9495/*96* @test TestRetainObjects97* @summary Acceptance tests: collector can deal with retained objects98* @requires vm.gc.Shenandoah99*100* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions101* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact102* TestRetainObjects103*/104105/*106* @test TestRetainObjects107* @summary Acceptance tests: collector can deal with retained objects108* @requires vm.gc.Shenandoah109*110* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions111* -XX:+UseShenandoahGC112* -XX:-UseTLAB -XX:+ShenandoahVerify113* TestRetainObjects114*/115116/*117* @test TestRetainObjects118* @summary Acceptance tests: collector can deal with retained objects119* @requires vm.gc.Shenandoah120*121* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions122* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive123* -XX:+ShenandoahOOMDuringEvacALot124* TestRetainObjects125*126* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions127* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive128* -XX:+ShenandoahAllocFailureALot129* TestRetainObjects130*131* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions132* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive133* TestRetainObjects134*/135136/*137* @test TestRetainObjects138* @summary Acceptance tests: collector can deal with retained objects139* @requires vm.gc.Shenandoah140*141* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions142* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu143* -XX:+ShenandoahVerify144* TestRetainObjects145*146* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions147* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu148* TestRetainObjects149*/150151public class TestRetainObjects {152153static final int COUNT = 10_000_000;154static final int WINDOW = 10_000;155156static final String[] reachable = new String[WINDOW];157158public static void main(String[] args) throws Exception {159int rIdx = 0;160for (int c = 0; c < COUNT; c++) {161reachable[rIdx] = ("LargeString" + c);162rIdx++;163if (rIdx >= WINDOW) {164rIdx = 0;165}166}167}168169}170171172