Skip to content

Commit

Permalink
System.runFinalization() is deprecated on Java 21 => removed the call
Browse files Browse the repository at this point in the history
that was used together with Java GC for benchmarks
  • Loading branch information
jlangch committed Feb 21, 2025
1 parent 771fdf8 commit 4b3519f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,7 @@ public VncVal apply(final VncList args) {
VncFunction
.meta()
.arglists("(gc)")
.doc(
"Run the Java garbage collector. Runs the finalization methods " +
"of any objects pending finalization prior to the GC.")
.doc("Run the Java garbage collector.")
.examples("(gc)")
.build()
) {
Expand All @@ -272,7 +270,7 @@ public VncVal apply(final VncList args) {

sandboxFunctionCallValidation();

Runtime.getRuntime().runFinalization();
// System.runFinalization(); // deprecated on Java 21
Runtime.getRuntime().gc();

return Nil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private static void sleep(final long millis) {

private static void runGCs(final long count) {
for(int ii=0; ii<count; ii++) {
System.runFinalization();
// System.runFinalization(); // deprecated on Java 21
System.gc();
}
}
Expand Down

0 comments on commit 4b3519f

Please sign in to comment.