Skip to content

Commit

Permalink
8305081: Remove finalize() from test/hotspot/jtreg/compiler/runtime/T…
Browse files Browse the repository at this point in the history
…est8168712

Reviewed-by: coleenp, thartmann
  • Loading branch information
Afshin Zafari committed May 12, 2023
1 parent f7bbbc6 commit 39dc40f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/hotspot/jtreg/compiler/runtime/Test8168712.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2023, 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 @@ -48,20 +48,31 @@
*/
package compiler.runtime;

import java.lang.ref.Cleaner;
import java.util.*;

public class Test8168712 {
static HashSet<Test8168712> m = new HashSet<>();

// One cleaner thread for cleaning all the instances. Otherwise, we get OOME.
static Cleaner cleaner = Cleaner.create();

public Test8168712() {
cleaner.register(this, () -> cleanup());
}

public static void main(String args[]) {
int i = 0;
while (i++<15000) {
test();
}
}

static Test8168712 test() {
return new Test8168712();
}
protected void finalize() {

public void cleanup() {
m.add(this);
}
}

1 comment on commit 39dc40f

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.