< prev index next >

test/gc/g1/humongousObjects/TestHumongousClassLoader.java

Print this page


   1 /*
   2  * Copyright (c) 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  */


  30 import java.io.IOException;
  31 import java.lang.reflect.InvocationTargetException;
  32 import java.net.URL;
  33 import java.net.URLClassLoader;
  34 import java.nio.file.Path;
  35 import java.nio.file.Paths;
  36 
  37 /**
  38  * @test gc.g1.humongousObjects.TestHumongousClassLoader
  39  * @summary Checks that unreachable classes and unreachable humongous class loader are unloaded after GC
  40  * @requires vm.gc.G1
  41  * @requires vm.opt.G1HeapRegionSize == "null" | vm.opt.G1HeapRegionSize == "1M"
  42  * @requires vm.opt.ExplicitGCInvokesConcurrent != true
  43  * @library /test/lib /
  44  * @modules java.base/jdk.internal.misc
  45  * @modules java.management
  46  * @build sun.hotspot.WhiteBox
  47  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  48  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  49  *
  50  * @run main/othervm/timeout=240  -Xms256M -Xmx256M -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  51  *                                gc.g1.humongousObjects.ClassLoaderGenerator 1
  52  *
  53  * @run main/othervm -Xms256M -Xmx256M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  54  *                   -Xlog:class+load,class+unload=debug:file=TestHumongousClassLoader_Full_GC.log
  55  *                   -XX:G1HeapRegionSize=1M
  56  *                   gc.g1.humongousObjects.TestHumongousClassLoader FULL_GC
  57  *
  58  * @run main/othervm -Xms256M -Xmx256M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  59  *                   -Xlog:class+load,class+unload=debug:file=TestHumongousClassLoader_Full_GC_Mem_Pressure.log
  60  *                   -XX:G1HeapRegionSize=1M
  61  *                   gc.g1.humongousObjects.TestHumongousClassLoader FULL_GC_MEMORY_PRESSURE
  62  *
  63  *@run main/othervm -Xms256M -Xmx256M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  64  *                   -Xlog:class+load,class+unload=debug:file=TestHumongousClassLoader_CMC.log
  65  *                   -XX:G1HeapRegionSize=1M -XX:MaxTenuringThreshold=1
  66  *                   gc.g1.humongousObjects.TestHumongousClassLoader CMC
  67  *
  68  */
  69 
  70 public class TestHumongousClassLoader {


   1 /*
   2  * Copyright (c) 2016, 2017, 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  */


  30 import java.io.IOException;
  31 import java.lang.reflect.InvocationTargetException;
  32 import java.net.URL;
  33 import java.net.URLClassLoader;
  34 import java.nio.file.Path;
  35 import java.nio.file.Paths;
  36 
  37 /**
  38  * @test gc.g1.humongousObjects.TestHumongousClassLoader
  39  * @summary Checks that unreachable classes and unreachable humongous class loader are unloaded after GC
  40  * @requires vm.gc.G1
  41  * @requires vm.opt.G1HeapRegionSize == "null" | vm.opt.G1HeapRegionSize == "1M"
  42  * @requires vm.opt.ExplicitGCInvokesConcurrent != true
  43  * @library /test/lib /
  44  * @modules java.base/jdk.internal.misc
  45  * @modules java.management
  46  * @build sun.hotspot.WhiteBox
  47  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  48  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  49  *
  50  * @run main/othervm/timeout=240  -Xms256M -Xmx256M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  51  *                                gc.g1.humongousObjects.ClassLoaderGenerator 1
  52  *
  53  * @run main/othervm -Xms256M -Xmx256M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  54  *                   -Xlog:class+load,class+unload=debug:file=TestHumongousClassLoader_Full_GC.log
  55  *                   -XX:G1HeapRegionSize=1M
  56  *                   gc.g1.humongousObjects.TestHumongousClassLoader FULL_GC
  57  *
  58  * @run main/othervm -Xms256M -Xmx256M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  59  *                   -Xlog:class+load,class+unload=debug:file=TestHumongousClassLoader_Full_GC_Mem_Pressure.log
  60  *                   -XX:G1HeapRegionSize=1M
  61  *                   gc.g1.humongousObjects.TestHumongousClassLoader FULL_GC_MEMORY_PRESSURE
  62  *
  63  *@run main/othervm -Xms256M -Xmx256M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  64  *                   -Xlog:class+load,class+unload=debug:file=TestHumongousClassLoader_CMC.log
  65  *                   -XX:G1HeapRegionSize=1M -XX:MaxTenuringThreshold=1
  66  *                   gc.g1.humongousObjects.TestHumongousClassLoader CMC
  67  *
  68  */
  69 
  70 public class TestHumongousClassLoader {


< prev index next >