Re: RFR: JDK-8276422 Add command-line option to disable finalization [v2]
On Thu, 18 Nov 2021 07:44:05 GMT, Aleksey Shipilev 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? I think @shipilev asks a good question. This could be done completely in the VM without the changes to j.l.ref.Finalizer. The CLI option is for experimenting, at least in the short term, and should be benign to have the Finalizer thread running, it just won't do anything. - PR: https://git.openjdk.java.net/jdk/pull/6442
Re: RFR: JDK-8276422 Add command-line option to disable finalization [v2]
> Pretty much what it says. The new option controls a static member in > InstanceKlass that's consulted to determine whether the finalization > machinery is activated for instances when a class is loaded. A new native > method is added so that this state can be queried from Java. This is used to > control whether a finalizer thread is created and to disable the `System` and > `Runtime::runFinalization` methods. Includes tests for the above. Stuart Marks has updated the pull request incrementally with one additional commit since the last revision: Include instanceKlass.hpp in arguments.cpp - Changes: - all: https://git.openjdk.java.net/jdk/pull/6442/files - new: https://git.openjdk.java.net/jdk/pull/6442/files/3836cc94..911af0b1 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=6442&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=6442&range=00-01 Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod Patch: https://git.openjdk.java.net/jdk/pull/6442.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/6442/head:pull/6442 PR: https://git.openjdk.java.net/jdk/pull/6442