RFR: 8309761: Leak class loader constraints
Zhengyu Gu
zgu at openjdk.org
Sat Jun 10 15:23:40 UTC 2023
On Sat, 10 Jun 2023 11:59:04 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
> Hi,
>
> Yes, this fixes the bug, but I'm confused.
>
> If `ConstraintSet` determines the lifetime of the `LoaderConstraint`s, then why isn't the type of `_constraints` `GrowableArray<LoaderConstraint>*`? `loaderConstraints.cpp:161` is the only place where we create `LoaderConstraint`s on the heap and also the only place where we call `add_constraint()`. I'd rather see that change, than adding code onto the destructor. Is there some reason that this can't be done?
>
> Cheers, Johan
I have not followed this part of code for a while, @coleenp probably is better person to ask.
One potential issue I see by changing `GrowableArray<LoaderConstraint*>*` to `GrowableArray<LoaderConstraint>*`, is that, if you have a dangling `LoaderConstraint*` pointer somewhere, then you call `remove_constraint()'`, that potential overwrites the content of the pointer points to.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14407#issuecomment-1585702641
More information about the hotspot-runtime-dev
mailing list