Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/*
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. 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
* Copyright (c) 2004, 2026, Oracle and/or its affiliates. All rights reserved.
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
Expand Down Expand Up @@ -46,9 +42,8 @@
* generated by nsk.share.gc.Generator (see its javadoc for more details).
* Each class has a huge number of fields, but this number is less than the JVM
* limitation.
* The test loads the classes with nsk.share.gc.GCClassUnloader class that
* extends nsk.share.ClassUnloader and has a bit different algorith of eating
* heap. As soon as a class is loaded, the test creates an instance of
* The test loads the classes with nsk.share.gc.GCClassUnloader class.
* As soon as a class is loaded, the test creates an instance of
* it - allocates an object of that type. Then it drops references to the
* class and to the instance and tries to unload the class. The test does not
* expect any exceptions to be thrown.
Expand All @@ -57,10 +52,13 @@
* /test/lib
*
* @comment generate and compile nsk.share.gc.newclass.* classes
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run driver nsk.share.gc.GenClassesBuilder
*
* @run main/othervm/timeout=300
* -XX:-UseGCOverheadLimit
* -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -Xlog:gc*
* gc.gctests.LargeObjects.large001.large001
* -largeClassesPath classes
Expand All @@ -79,6 +77,7 @@

import nsk.share.gc.*;
import nsk.share.*;
import jdk.test.whitebox.WhiteBox;

public class large001 extends ThreadedGCTest {

Expand Down Expand Up @@ -146,8 +145,8 @@ public void run() {
List<WeakReference> refs = new ArrayList<WeakReference>(depth);
addObjRef(loadedClassInstance, loadedClass, depth, refs);

// Drop all references to the class and try to unload it
Algorithms.eatMemory(getExecutionController());
// Keep all references to the class and try to unload it
WhiteBox.getWhiteBox().fullGC();
log.debug(id + ": Testing non-null after GC force for: " + name);
if (loadedClass == null || loadedClassInstance == null) {
throw new Exception("Null class");
Expand All @@ -158,21 +157,14 @@ public void run() {
throw new Exception("Unexpected null reference");
}
}
// Drop all references to the class and try to unload it
refs = null;
loadedClass = null;
loadedClassInstance = null;

log.debug(id + ": Unloading class: "
+ name);
boolean result = unloader.unloadClass(getExecutionController());
log.debug(id + ": Result of uloading "
+ "class " + name + ": " + result);
}
} catch (OutOfMemoryError oome) {
// just skip if we eat memory in several threads...
// rethrow in the case of one thread
if (runParams.getNumberOfThreads() == 1) {
throw oome;
WhiteBox.getWhiteBox().fullGC();
}
} catch (Throwable t) {
throw new TestFailure("Unexpected exception: ", t);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2026, Oracle and/or its affiliates. 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
Expand Down Expand Up @@ -47,9 +47,8 @@
* generated by nsk.share.gc.Generator (see its javadoc for more details).
* Each class has a huge number of fields, and the number of fields is more than
* the JVM limitation.
* The test loads the classes with nsk.share.gc.GCClassUnloader class that
* extends nsk.share.ClassUnloader and has a bit different algorith of eating
* heap. As soon as a class is loaded, the test creates an instance of
* The test loads the classes with nsk.share.gc.GCClassUnloader class.
* As soon as a class is loaded, the test creates an instance of
* it - allocates an object of that type. Then it drops references to the
* class and to the instance and tries to unload the class. The test does not
* expect any exceptions to be thrown.
Expand All @@ -58,10 +57,13 @@
* /test/lib
*
* @comment generate and compile nsk.share.gc.newclass.* classes
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run driver nsk.share.gc.GenClassesBuilder
*
* @run main/othervm/timeout=300
* -XX:-UseGCOverheadLimit
* -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* gc.gctests.LargeObjects.large001.large001
* -largeClassesPath classes
* -isOverLimitFields true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2026, Oracle and/or its affiliates. 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
Expand Down Expand Up @@ -47,9 +47,8 @@
* generated by nsk.share.gc.Generator (see its javadoc for more details).
* Each class has a huge number of fields, but this number is less than the JVM
* limitation.
* The test loads the classes with nsk.share.gc.GCClassUnloader class that
* extends nsk.share.ClassUnloader and has a bit different algorith of eating
* heap. As soon as a class is loaded, the test creates an instance of
* The test loads the classes with nsk.share.gc.GCClassUnloader class.
* As soon as a class is loaded, the test creates an instance of
* it - allocates an object of that type. Then it drops references to the
* class and to the instance and tries to unload the class. The test does not
* expect any exceptions to be thrown.
Expand All @@ -62,10 +61,13 @@
* /test/lib
*
* @comment generate and compile nsk.share.gc.newclass.* classes
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run driver nsk.share.gc.GenClassesBuilder
*
* @run main/othervm/timeout=300
* -XX:-UseGCOverheadLimit
* -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* gc.gctests.LargeObjects.large001.large001
* -largeClassesPath classes
* -isOverLimitFields false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2026, Oracle and/or its affiliates. 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
Expand Down Expand Up @@ -47,9 +47,8 @@
* generated by nsk.share.gc.Generator (see its javadoc for more details).
* Each class has a huge number of fields, but this number is less than the JVM
* limitation.
* The test loads the classes with nsk.share.gc.GCClassUnloader class that
* extends nsk.share.ClassUnloader and has a bit different algorith of eating
* heap. As soon as a class is loaded, the test creates an instance of
* The test loads the classes with nsk.share.gc.GCClassUnloader class.
* As soon as a class is loaded, the test creates an instance of
* it - allocates an object of that type. Then it drops references to the
* class and to the instance and tries to unload the class. The test does not
* expect any exceptions to be thrown.
Expand All @@ -62,10 +61,13 @@
* /test/lib
*
* @comment generate and compile nsk.share.gc.newclass.* classes
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run driver nsk.share.gc.GenClassesBuilder
*
* @run main/othervm/timeout=300
* -XX:-UseGCOverheadLimit
* -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* gc.gctests.LargeObjects.large001.large001
* -largeClassesPath classes
* -isOverLimitFields true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2026, Oracle and/or its affiliates. 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
Expand Down Expand Up @@ -47,9 +47,8 @@
* generated by nsk.share.gc.Generator (see its javadoc for more details).
* Each class has a huge number of fields, but this number is less than the JVM
* limitation.
* The test loads the classes with nsk.share.gc.GCClassUnloader class that
* extends nsk.share.ClassUnloader and has a bit different algorith of eating
* heap. As soon as a class is loaded, the test creates an instance of
* The test loads the classes with nsk.share.gc.GCClassUnloader class.
* As soon as a class is loaded, the test creates an instance of
* it - allocates an object of that type. Then it drops references to the
* class and to the instance and tries to unload the class. The test does not
* expect any exceptions to be thrown.
Expand All @@ -62,10 +61,13 @@
* /test/lib
*
* @comment generate and compile nsk.share.gc.newclass.* classes
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run driver nsk.share.gc.GenClassesBuilder
*
* @run main/othervm/timeout=300
* -XX:-UseGCOverheadLimit
* -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* gc.gctests.LargeObjects.large001.large001
* -largeClassesPath classes
* -isOverLimitFields true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2026, Oracle and/or its affiliates. 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
Expand Down Expand Up @@ -55,6 +55,8 @@
* nsk.jdi.ClassObjectReference.reflectedType.reflectype002a
*
* @comment compile loadclassXX to bin/loadclassXX
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run driver nsk.share.ExtraClassesBuilder
* loadclass
*
Expand All @@ -65,6 +67,7 @@
* -waittime=5
* -debugee.vmkind=java
* -transport.address=dynamic
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}" ./bin
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI"
* ./bin
*/

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2026, Oracle and/or its affiliates. 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
Expand Down Expand Up @@ -42,7 +42,7 @@
* debugger and debugee communicates with special commands.
* The debugger forces debuggee to load checked class, creates and
* enables ClassUnloadRequest. Next, debugger forces debuggee to
* unload class, using memory stressing techique, and waits for
* unload class, using whitebox full GC techique, and waits for
* ClassUnloadEvent.
* If expected ClassUnloadEvent occurs, debugger tests method
* ClassUnloadEvent.className() and verifies that this event
Expand Down Expand Up @@ -81,6 +81,8 @@
* nsk.jdi.ClassUnloadEvent.className.classname001a
*
* @comment compile loadclassXX to bin/loadclassXX
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run driver nsk.share.ExtraClassesBuilder
* loadclass
*
Expand All @@ -92,6 +94,6 @@
* -waittime=5
* -debugee.vmkind=java
* -transport.address=dynamic
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI"
*/

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2026, Oracle and/or its affiliates. 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
Expand Down Expand Up @@ -44,7 +44,7 @@
* debugger and debugee communicates with special commands.
* The debugger forces debugge to load checked classes, creates and
* enables ClassUnloadRequest. Next, debugger forces debuggee to
* unload classes, using memory stressing techique, and waits for
* unload classes, using whitebox full GC techique, and waits for
* ClassUnloadEvent.
* If each expected ClassUnloadEvent occurs, debugger tests method
* ClassUnloadEvent.classSignature() and verifies that this event
Expand Down Expand Up @@ -87,6 +87,8 @@
* nsk.jdi.ClassUnloadEvent.classSignature.signature001a
*
* @comment compile loadclassXX to bin/loadclassXX
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run driver nsk.share.ExtraClassesBuilder
* loadclass
*
Expand All @@ -98,6 +100,6 @@
* -waittime=5
* -debugee.vmkind=java
* -transport.address=dynamic
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI"
*/

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2026, Oracle and/or its affiliates. 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
Expand Down Expand Up @@ -67,6 +67,8 @@
* nsk.jdi.ClassUnloadRequest.addClassExclusionFilter.exclfilter001a
*
* @comment compile loadclassXX to bin/loadclassXX
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run driver nsk.share.ExtraClassesBuilder
* loadclass
*
Expand All @@ -77,6 +79,7 @@
* -waittime=5
* -debugee.vmkind=java
* -transport.address=dynamic
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}" ./bin
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI"
* ./bin
*/

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2026, Oracle and/or its affiliates. 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
Expand Down Expand Up @@ -65,6 +65,8 @@
* nsk.jdi.ClassUnloadRequest.addClassFilter.filter001a
*
* @comment compile loadclassXX to bin/loadclassXX
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run driver nsk.share.ExtraClassesBuilder
* loadclass
*
Expand All @@ -75,6 +77,7 @@
* -waittime=5
* -debugee.vmkind=java
* -transport.address=dynamic
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}" ./bin
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI"
* ./bin
*/

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2026, Oracle and/or its affiliates. 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
Expand Down Expand Up @@ -55,6 +55,8 @@
* nsk.jdi.ReferenceType.allFields.allfields003a
*
* @comment compile loadclassXX to bin/loadclassXX
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run driver nsk.share.ExtraClassesBuilder
* loadclass
*
Expand All @@ -65,6 +67,7 @@
* -waittime=5
* -debugee.vmkind=java
* -transport.address=dynamic
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}" ./bin
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI"
* ./bin
*/

Loading