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

Coleen Phillimore coleenp at openjdk.org
Thu Dec 8 20:06:39 UTC 2022


On Thu, 8 Dec 2022 06:29:31 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Justin King has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update include order to be alphabetical
>>   
>>   Signed-off-by: Justin King <jcking at google.com>
>
> src/hotspot/share/memory/metadataFactory.hpp line 77:
> 
>> 75:       if (invoke_destructor) {
>> 76:         using U = typename RemoveCV<typename RemovePointer<T>::type>::type;
>> 77:         md->~U();
> 
> I was actually thinking of a template specialization for MethodData, but I guess this works. Lets see what others think.

I don't think you can do this here.  The preceding deallocate_contents() function will deallocate the metadata so this might crash.  It's like calling the destructor after the delete operator.
Maybe before it the deallocate contents call?
Specializing for MethodData might work if you add code to tell InstanceKlass::deallocate_contents() not to call release_C_heap_structures on methods.

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

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


More information about the hotspot-dev mailing list