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

Justin King jcking at openjdk.org
Thu Dec 8 06:11:39 UTC 2022


On Thu, 8 Dec 2022 05:01:11 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:
> 
>   Fix memory leak by calling destructor
>   
>   Signed-off-by: Justin King <jcking at google.com>

> > Yeah, that is what I was thinking. [jcking at 5f1aad3](https://github.com/jcking/jdk/commit/5f1aad3723b56566428df7b4780ef2d5ca87f29d) is an example of this approach.
> 
> That is somewhat more elaborate/complex than I envisaged - and I'm not sure all those C++ features are usable in hotspot at present. Can we just add a specialized version of `free_metadata` for `MethodData` which takes the extra parameter?

That works for me, though all those features should be C++11 and C++14. Added a default argument to `MetadataFactory::free_metadata` that controls whether the destructor is invoked. If is false by default.

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

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


More information about the hotspot-dev mailing list