[jdk20] RFR: 8298084: Memory leak in Method::build_profiling_method_data [v2]

Kim Barrett kbarrett at openjdk.org
Mon Dec 12 17:39:16 UTC 2022


On Mon, 12 Dec 2022 17:08:38 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> This change fixes the MethodData leak by calling the destructor in both the release_C_heap_structures conditionally and by calling the MethodData destructor in the MetadataFactory::free_metadata method.
>> Thanks to @jcking for working on the patch and discussion.
>> Tested with tier1-4.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix metaprogramming

Marked as reviewed by kbarrett (Reviewer).

src/hotspot/share/memory/metadataFactory.hpp line 78:

> 76:       // T is a potentially const or volatile qualified pointer. Remove the pointer and any const
> 77:       // or volatile so we can call the destructor of the type T points to.
> 78:       using U = std::remove_cv_t<std::remove_pointer_t<T>>;

Could get rid of `remove_pointer` by changing the function parameter from `T md` to `T* md`.  Apologies for not thinking of that earlier.

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

PR: https://git.openjdk.org/jdk20/pull/13


More information about the hotspot-dev mailing list