RFR: JDK-8276422 Add command-line option to disable finalization

David Holmes dholmes at openjdk.java.net
Thu Nov 18 07:58:39 UTC 2021


On Thu, 18 Nov 2021 07:44:05 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> @shipilev not sure what you mean by  "a flag on the Java side". The Java code just queries the VM for the finalization enabled/disabled state and uses that to control things.
>
> Yeah, "flag" is `Holder.ENABLED` here. I mean, are Java methods `registerFinalizer` and `runFinalization` called only by VM? If so, can VM check the whole thing on VM side, without going to Java and asking back from there?

`registerFinalizer` does not expect to be called and only uses the "flag" as a form of assertion.

`runFinalization` is called from Java code.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6442



More information about the build-dev mailing list