On Tue, 26 Sep 2023 12:47:42 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:
> This change makes WeakHandle and OopHandle release null out the obj pointer, > at the cost of making the release function non-const and some changes that > propagated from that. This enables ObjectMonitor code to test for null to > see if the obj was already released, and seems like the right thing to do. > See comments from related PR in the bug report. > Tested with tier1-4. Nulling out `_obj` seems quite reasonable. But I'm struggling to understand why we support `release` as a public API instead of having it handled by the destructor? One you have released a handle it is dangerous to try and use it so why keep it around instead of deleting it (and thus running the destructor)? Thanks ------------- Marked as reviewed by dholmes (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/15920#pullrequestreview-1645748643