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

Coleen Phillimore coleenp at openjdk.org
Fri Jul 28 12:23:54 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

I have a suggestion for your test and copyright fix.

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

> 1: /*
> 2:  * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.

Please remove the 2016 copyright on the new test.

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

> 56:             }
> 57:         }
> 58:     }

If you look in that directory, there's an even simpler way to redefine classes without the Transformer and agent code.  It looks like this:  RedefineClassHelper.redefineClass(RedefineRunningMethods_B.class, evenNewerB);

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

Changes requested by coleenp (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/14780#pullrequestreview-1552009914
PR Review Comment: https://git.openjdk.org/jdk/pull/14780#discussion_r1277479719
PR Review Comment: https://git.openjdk.org/jdk/pull/14780#discussion_r1277482646


More information about the serviceability-dev mailing list