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

David Holmes dholmes at openjdk.org
Tue Dec 13 00:19:08 UTC 2022


On Mon, 12 Dec 2022 17:51:25 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:
> 
>   Even more metaprogramming improvements

Not sure about some of the incidental changes - see below.

Thanks.

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

> 75:       // destructors and/or cleanup using deallocate_contents.
> 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.

Comment needs updating now you don't need to remove the pointer.

src/hotspot/share/oops/instanceKlass.cpp line 2675:

> 2673:   if (release_sub_metadata) {
> 2674:     methods_do(method_release_C_heap_structures);
> 2675:   }

I don't understand this aspect of the change. It seems unrelated to the missing destructor issue and seems to cause a significant change in behaviour as we will no longer call `methods_do` when called from `deallocate_contents` with the renamed `false` argument.

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

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


More information about the hotspot-dev mailing list