RFR: 8309599: WeakHandle and OopHandle release should clear obj pointer
David Holmes
dholmes at openjdk.org
Fri Sep 29 03:15:42 UTC 2023
On Thu, 28 Sep 2023 11:58:23 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
> > Hmmm okay - it seems fragile to have a psuedo-destructor in release().
>
> I don't know what this comment means.
Object lifetimes should be well managed such that you can't use an object after it has been "destroyed". Methods like `release()` effectively nuke the internals of the object but the object is still available to be (mis)used. Before this fix `release` left a dangling `_obj` pointer, but that wouldn't be an issue if the handle itself could not be used after being released.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/15920#issuecomment-1740244084
More information about the serviceability-dev
mailing list