RFR: 8308762: Metaspace leak with Instrumentation.retransform [v6]

David Holmes dholmes at openjdk.org
Wed Sep 20 00:22:43 UTC 2023


On Thu, 3 Aug 2023 08:43:12 GMT, Jean-Philippe Bempel <jpbempel at openjdk.org> wrote:

>> Fix a small leak in constant pool merging during retransformation of a class. If this class has a catch block with `Throwable`, the class `Throwable` is pre-resolved in the constant pool, while all the other classes are in a unresolved state. So the constant pool merging process was considering the entry with pre-resolved class as different compared to the destination and create a new entry. We now try to consider it as equal specially for Methodref/Fieldref.
>
> Jean-Philippe Bempel has updated the pull request incrementally with one additional commit since the last revision:
> 
>   remove trailing whitespace

Based on the previous discussion and comments this simple change seems quite reasonable to me.

One query on the test though.

Thanks

test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineLeakThrowable.java line 28:

> 26:  # @bug 8308762
> 27:  * @library /test/lib
> 28:  * @summary Test that redefinition of class containing Throwable refs does not leak constant pool

Exactly how is this test tracking whether there is a leak or not? Is it simply setting metaspace size small enough that the 500 iterations would exhaust metaspace if there were a leak?

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

PR Review: https://git.openjdk.org/jdk/pull/14780#pullrequestreview-1634362012
PR Review Comment: https://git.openjdk.org/jdk/pull/14780#discussion_r1330816904


More information about the serviceability-dev mailing list