Finalizer being run while class still in use (escape analysis bug)

Andrew Haley aph at redhat.com
Wed Oct 10 09:16:13 UTC 2018


On 10/10/2018 10:10 AM, Luke Hutchison wrote:

> My point was that if any *non-static* method of an object instance
> is currently running (i.e.  whenever an object is "currently serving
> as an invocation target"), that object should never be considered
> unreachable.

That's incorrect.

> I believe that I did not misread the spec, and that this is covered
> by the wording, "A reachable object is any object that can be
> accessed in any potential continuing computation from any live
> thread", since if a non-static method of an object is currently
> running, that object not only "can be accessed" by a live thread, it
> *is* currently being accessed by a live thread.

No. Believe it or not, a live method does not constitute an access
to an object. An object can die and be finalized even before one
if its methods is entered.

-- 
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671


More information about the jdk-dev mailing list