Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JEP 421: Deprecate Finalization for Removal #14049

Closed
tajila opened this issue Dec 1, 2021 · 11 comments
Closed

JEP 421: Deprecate Finalization for Removal #14049

tajila opened this issue Dec 1, 2021 · 11 comments

Comments

@tajila
Copy link
Contributor

tajila commented Dec 1, 2021

See https://openjdk.java.net/jeps/421

We propose to:

    Add a command-line option to disable finalization, so that no finalizers are ever scheduled by the GC to run, and
    Deprecate all finalizers, and finalization-related methods, in the standard Java API.

@tajila
Copy link
Contributor Author

tajila commented Dec 1, 2021

FYI @dmitripivkine

@tajila
Copy link
Contributor Author

tajila commented Dec 1, 2021

The option will be --finalization=[enabled|disabled] it will be enabled by default.

The effect of disabling finalization is as follows:

 * When a class is loaded into the JVM, the detection of a non-trivial finalize() method in the class is disabled. 
 This prevents creation of finalization-related data structures by various GCs. This also disables the upcall to 
Finalizer::register, which prevents finalization-eligible objects from ever appearing on the heap. 
FinalReference processing will therefore not be done, and objects' finalize() methods won't be called.

 * The finalizer thread is not created.

 * Calls to `System::runFinalization` and `Runtime::runFinalization` have no effect.

@tajila
Copy link
Contributor Author

tajila commented Dec 1, 2021

Its likely we will fail tests once this gets in the jdk18 repo due to the fact that we do not yet recognize the option

@tajila
Copy link
Contributor Author

tajila commented Dec 1, 2021

@JasonFengJ9 Can you take a look at this once it lands

@pshipton
Copy link
Member

pshipton commented Dec 1, 2021

Its likely we will fail tests once this gets in the jdk18 repo due to the fact that we do not yet recognize the option

It depends how --finalization is processed. It may be done by the launcher and turned into a system property.

@pshipton
Copy link
Member

pshipton commented Dec 1, 2021

Well we likely still need to add something to the Object.finalize() method.

@JasonFengJ9 JasonFengJ9 self-assigned this Dec 1, 2021
@pshipton
Copy link
Member

pshipton commented Dec 8, 2021

I see JVM_IsFinalizationEnabled() added.

@JasonFengJ9
Copy link
Member

I see JVM_IsFinalizationEnabled() added.

Okay, will add it.

@keithc-ca
Copy link
Contributor

See also #14114.

@tajila
Copy link
Contributor Author

tajila commented Jan 27, 2022

Can this be closed @JasonFengJ9 ?

@JasonFengJ9
Copy link
Member

I am not aware any outstanding task required by this JEP.

Closing..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants