RFR: JDK-8298084: Memory leak in Method::build_profiling_method_data [v6]

Coleen Phillimore coleenp at openjdk.org
Thu Dec 8 19:25:20 UTC 2022


On Thu, 8 Dec 2022 08:19:26 GMT, Justin King <jcking at openjdk.org> wrote:

>> Resolve memory leak related to `MethodData::_extra_data_lock` in `Method::build_profiling_method_data` by calling `MethodData::~MethodData()`.
>
> Justin King has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add comment to metaprogramming usage
>   
>   Signed-off-by: Justin King <jcking at google.com>

I don't like the additional c++ code for the exceptional case of MethodData.  The lifetime of Metadata and it will leak for class unloading.  I think fixing this to be more rational for the general case would be better via the RFE that you submitted.

src/hotspot/share/oops/method.cpp line 148:

> 146: #endif
> 147:     // Destroy MethodData
> 148:     method_data()->~MethodData();

You still need this here.  This is for the class unloading path.

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

Changes requested by coleenp (Reviewer).

PR: https://git.openjdk.org/jdk/pull/11526


More information about the hotspot-dev mailing list