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

Serguei Spitsyn sspitsyn at openjdk.org
Wed Jul 19 10:01:46 UTC 2023


On Tue, 18 Jul 2023 16:48:55 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 refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
> 
>   Revert resolved class to unresolved for comparison
>   
>   remove is_unresolved_class_mismatch

src/hotspot/share/oops/constantPool.cpp line 1295:

> 1293:     t1 = JVM_CONSTANT_UnresolvedClass;
> 1294:   }
> 1295: 

All consequences of this change are not clear to me yet.
The lines 1307-1314 become not needed anymore.
Also, should the same be done for t2 as well?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14780#discussion_r1267851499


More information about the serviceability-dev mailing list