RFR: 8309761: Leak class loader constraints

Johan Sjölen jsjolen at openjdk.org
Sun Jun 11 22:00:57 UTC 2023


On Sun, 11 Jun 2023 13:03:10 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

> > Thanks for the reply. That's true, but I don't see how we know whether we have a dangling pointer by the end of your destructor or not either. References aren't a 100% guarantee for that either, but it is an improvement.
> 
> Reference or pointer make no difference and it has nothing to do with destructor. Consider following scenario:
> 
> There are 3 constraints in `_constraints` array, `c0`, `c1` and `c2` and there is an outstanding reference ` r = &c1`. If there is a call to `remove_contraint(c0)`, `_constraints` array shifts to left, now `r` refers to `c2`, instead of `c1`.

Alright, that makes a lot of sense. Thank you for explaining :).

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

PR Comment: https://git.openjdk.org/jdk/pull/14407#issuecomment-1586352074


More information about the hotspot-runtime-dev mailing list