< prev index next >

test/hotspot/jtreg/gc/class_unloading/TestG1ClassUnloadingHWM.java

Print this page
rev 50628 : imported patch 8204084-stefanj-review
rev 50629 : imported patch 8204084-stefanj-review2
   1 /*
   2  * Copyright (c) 2014, 2016, Oracle and/or its affiliates. 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  */


  57       "-Xlog:gc",
  58       TestG1ClassUnloadingHWM.AllocateBeyondMetaspaceSize.class.getName(),
  59       "" + MetaspaceSize,
  60       "" + YoungGenSize);
  61     return new OutputAnalyzer(pb.start());
  62   }
  63 
  64   public static OutputAnalyzer runWithG1ClassUnloading() throws Exception {
  65     return run(true);
  66   }
  67 
  68   public static OutputAnalyzer runWithoutG1ClassUnloading() throws Exception {
  69     return run(false);
  70   }
  71 
  72   public static void testWithoutG1ClassUnloading() throws Exception {
  73     // -XX:-ClassUnloadingWithConcurrentMark is used, so we expect a full GC instead of a concurrent cycle.
  74     OutputAnalyzer out = runWithoutG1ClassUnloading();
  75 
  76     out.shouldMatch(".*Pause Full.*");
  77     out.shouldNotMatch(".*Pause Initial Mark.*");
  78   }
  79 
  80   public static void testWithG1ClassUnloading() throws Exception {
  81     // -XX:+ClassUnloadingWithConcurrentMark is used, so we expect a concurrent cycle instead of a full GC.
  82     OutputAnalyzer out = runWithG1ClassUnloading();
  83 
  84     out.shouldMatch(".*Pause Initial Mark.*");
  85     out.shouldNotMatch(".*Pause Full.*");
  86   }
  87 
  88   public static void main(String args[]) throws Exception {
  89     testWithG1ClassUnloading();
  90     testWithoutG1ClassUnloading();
  91   }
  92 
  93   public static class AllocateBeyondMetaspaceSize {
  94     public static Object dummy;
  95 
  96     public static void main(String [] args) throws Exception {
  97       if (args.length != 2) {
  98         throw new IllegalArgumentException("Usage: <MetaspaceSize> <YoungGenSize>");
  99       }
 100 
 101       WhiteBox wb = WhiteBox.getWhiteBox();
 102 
 103       // Allocate past the MetaspaceSize limit
 104       long metaspaceSize = Long.parseLong(args[0]);
   1 /*
   2  * Copyright (c) 2014, 2018, Oracle and/or its affiliates. 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  */


  57       "-Xlog:gc",
  58       TestG1ClassUnloadingHWM.AllocateBeyondMetaspaceSize.class.getName(),
  59       "" + MetaspaceSize,
  60       "" + YoungGenSize);
  61     return new OutputAnalyzer(pb.start());
  62   }
  63 
  64   public static OutputAnalyzer runWithG1ClassUnloading() throws Exception {
  65     return run(true);
  66   }
  67 
  68   public static OutputAnalyzer runWithoutG1ClassUnloading() throws Exception {
  69     return run(false);
  70   }
  71 
  72   public static void testWithoutG1ClassUnloading() throws Exception {
  73     // -XX:-ClassUnloadingWithConcurrentMark is used, so we expect a full GC instead of a concurrent cycle.
  74     OutputAnalyzer out = runWithoutG1ClassUnloading();
  75 
  76     out.shouldMatch(".*Pause Full.*");
  77     out.shouldNotMatch(".*Pause Young \\(Concurrent Start\\).*");
  78   }
  79 
  80   public static void testWithG1ClassUnloading() throws Exception {
  81     // -XX:+ClassUnloadingWithConcurrentMark is used, so we expect a concurrent cycle instead of a full GC.
  82     OutputAnalyzer out = runWithG1ClassUnloading();
  83 
  84     out.shouldMatch(".*Pause Young \\(Concurrent Start\\).*");
  85     out.shouldNotMatch(".*Pause Full.*");
  86   }
  87 
  88   public static void main(String args[]) throws Exception {
  89     testWithG1ClassUnloading();
  90     testWithoutG1ClassUnloading();
  91   }
  92 
  93   public static class AllocateBeyondMetaspaceSize {
  94     public static Object dummy;
  95 
  96     public static void main(String [] args) throws Exception {
  97       if (args.length != 2) {
  98         throw new IllegalArgumentException("Usage: <MetaspaceSize> <YoungGenSize>");
  99       }
 100 
 101       WhiteBox wb = WhiteBox.getWhiteBox();
 102 
 103       // Allocate past the MetaspaceSize limit
 104       long metaspaceSize = Long.parseLong(args[0]);
< prev index next >