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

David Holmes dholmes at openjdk.org
Thu Dec 8 05:49:47 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>

Sorry, the destructor has to, of course, be used in a safe manner - I didn't mean to imply otherwise. Given what `free_metadata` does with the `md` we can't call the destructor before calling it. Perhaps we can add a default parameter `bool invoke_destructor = false` to `free_metadata`, to then call the destructor at the right point (which would be before or after `md->deallocate_contents`).

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

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


More information about the hotspot-dev mailing list