< prev index next >

test/hotspot/jtreg/runtime/Metaspace/DefineClass.java

Print this page

        

*** 1,6 **** --- 1,7 ---- /* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as
*** 27,47 **** * @requires vm.compMode != "Xcomp" * @summary Failures during class definition can lead to memory leaks in metaspace * @library /test/lib * @run main/othervm test.DefineClass defineClass * @run main/othervm test.DefineClass defineSystemClass ! * @run main/othervm -XX:+UnlockDiagnosticVMOptions ! -XX:+UnsyncloadClass -XX:+AllowParallelDefineClass test.DefineClass defineClassParallel ! * @run main/othervm -XX:+UnlockDiagnosticVMOptions ! -XX:+UnsyncloadClass -XX:-AllowParallelDefineClass ! test.DefineClass defineClassParallel ! * @run main/othervm -XX:+UnlockDiagnosticVMOptions ! -XX:-UnsyncloadClass -XX:+AllowParallelDefineClass ! test.DefineClass defineClassParallel ! * @run main/othervm -XX:+UnlockDiagnosticVMOptions ! -XX:-UnsyncloadClass -XX:-AllowParallelDefineClass test.DefineClass defineClassParallel * @run main/othervm -Djdk.attach.allowAttachSelf test.DefineClass redefineClass * @run main/othervm -Djdk.attach.allowAttachSelf test.DefineClass redefineClassWithError * @author volker.simonis@gmail.com */ --- 28,40 ---- * @requires vm.compMode != "Xcomp" * @summary Failures during class definition can lead to memory leaks in metaspace * @library /test/lib * @run main/othervm test.DefineClass defineClass * @run main/othervm test.DefineClass defineSystemClass ! * @run main/othervm -XX:+AllowParallelDefineClass test.DefineClass defineClassParallel ! * @run main/othervm -XX:-AllowParallelDefineClass test.DefineClass defineClassParallel * @run main/othervm -Djdk.attach.allowAttachSelf test.DefineClass redefineClass * @run main/othervm -Djdk.attach.allowAttachSelf test.DefineClass redefineClassWithError * @author volker.simonis@gmail.com */
*** 124,134 **** @SuppressWarnings("unchecked") Class<DefineClass> dc = (Class<DefineClass>) pcl.myDefineClass(DefineClass.class.getName(), buf, 0, buf.length); } catch (LinkageError jle) { // Expected with a parallel capable class loader and ! // -XX:+UnsyncloadClass or -XX:+AllowParallelDefineClass pcl.incrementLinkageErrors(); } } } --- 117,127 ---- @SuppressWarnings("unchecked") Class<DefineClass> dc = (Class<DefineClass>) pcl.myDefineClass(DefineClass.class.getName(), buf, 0, buf.length); } catch (LinkageError jle) { // Expected with a parallel capable class loader and ! // -XX:+AllowParallelDefineClass pcl.incrementLinkageErrors(); } } }
*** 318,328 **** for (int i = 0; i < iterations; i++) { threads[i].join(); } System.out.print("Counted " + pcl.getLinkageErrors() + " LinkageErrors "); System.out.println(pcl.getLinkageErrors() == 0 ? ! "" : "(use -XX:+UnsyncloadClass and/or -XX:+AllowParallelDefineClass to avoid this)"); System.gc(); System.out.println("System.gc()"); // After System.gc() we expect to remain with two instances: one is the initial version which is // kept alive by this main method and another one in the parallel class loader. printClassStats(2, true); --- 311,321 ---- for (int i = 0; i < iterations; i++) { threads[i].join(); } System.out.print("Counted " + pcl.getLinkageErrors() + " LinkageErrors "); System.out.println(pcl.getLinkageErrors() == 0 ? ! "" : "(use -XX:+AllowParallelDefineClass to avoid this)"); System.gc(); System.out.println("System.gc()"); // After System.gc() we expect to remain with two instances: one is the initial version which is // kept alive by this main method and another one in the parallel class loader. printClassStats(2, true);
< prev index next >