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

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


On Thu, 8 Dec 2022 20:00:24 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> 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.

Also don't you have to free this?
    FailedSpeculation::free_failed_speculations(method_data()->get_failed_speculations_address());

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

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


More information about the hotspot-dev mailing list