Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/gc/shenandoah/TestRetainObjects.java
32284 views
/*1* Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation.6*7* This code is distributed in the hope that it will be useful, but WITHOUT8* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or9* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License10* version 2 for more details (a copy is included in the LICENSE file that11* accompanied this code).12*13* You should have received a copy of the GNU General Public License version14* 2 along with this work; if not, write to the Free Software Foundation,15* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.16*17* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA18* or visit www.oracle.com if you need additional information or have any19* questions.20*21*/2223/*24* @test TestRetainObjects25* @summary Acceptance tests: collector can deal with retained objects26* @key gc27*28* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions29* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive30* -XX:+ShenandoahDegeneratedGC -XX:+ShenandoahVerify31* TestRetainObjects32*33* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions34* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive35* -XX:-ShenandoahDegeneratedGC -XX:+ShenandoahVerify36* TestRetainObjects37*38* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions39* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive40* -XX:+ShenandoahDegeneratedGC41* TestRetainObjects42*43* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions44* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive45* -XX:-ShenandoahDegeneratedGC46* TestRetainObjects47*/4849/*50* @test TestRetainObjects51* @summary Acceptance tests: collector can deal with retained objects52* @key gc53*54* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions55* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive56* -XX:+ShenandoahOOMDuringEvacALot57* TestRetainObjects58*59* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions60* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive61* -XX:+ShenandoahAllocFailureALot62* TestRetainObjects63*64* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions65* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive66* TestRetainObjects67*/6869/*70* @test TestRetainObjects71* @summary Acceptance tests: collector can deal with retained objects72* @key gc73*74* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions75* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive76* -XX:+ShenandoahVerify77* TestRetainObjects78*79* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions80* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive81* TestRetainObjects82*/8384/*85* @test TestRetainObjects86* @summary Acceptance tests: collector can deal with retained objects87* @key gc88*89* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions90* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static91* TestRetainObjects92*/9394/*95* @test TestRetainObjects96* @summary Acceptance tests: collector can deal with retained objects97* @key gc98*99* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions100* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact101* TestRetainObjects102*/103104/*105* @test TestRetainObjects106* @summary Acceptance tests: collector can deal with retained objects107* @key gc108*109* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions110* -XX:+UseShenandoahGC111* -XX:-UseTLAB -XX:+ShenandoahVerify112* TestRetainObjects113*/114115/*116* @test TestRetainObjects117* @summary Acceptance tests: collector can deal with retained objects118* @key gc119*120* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions121* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive122* -XX:+ShenandoahOOMDuringEvacALot123* TestRetainObjects124*125* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions126* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive127* -XX:+ShenandoahAllocFailureALot128* TestRetainObjects129*130* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions131* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive132* TestRetainObjects133*/134135/*136* @test TestRetainObjects137* @summary Acceptance tests: collector can deal with retained objects138* @key gc139*140* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions141* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu142* -XX:+ShenandoahVerify143* TestRetainObjects144*145* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions146* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu147* TestRetainObjects148*/149150public class TestRetainObjects {151152static final int COUNT = 10_000_000;153static final int WINDOW = 10_000;154155static final String[] reachable = new String[WINDOW];156157public static void main(String[] args) throws Exception {158int rIdx = 0;159for (int c = 0; c < COUNT; c++) {160reachable[rIdx] = ("LargeString" + c);161rIdx++;162if (rIdx >= WINDOW) {163rIdx = 0;164}165}166}167168}169170171