RFR: JDK-8298084: Memory leak in Method::build_profiling_method_data

David Holmes dholmes at openjdk.org
Wed Dec 7 09:26:13 UTC 2022


On Wed, 7 Dec 2022 08:28:18 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Resolve memory leak related to `MethodData::_extra_data_lock` in `Method::build_profiling_method_data` by defining `MethodData::release_C_heap_structures` and calling it where appropriate before deallocating `MethodData`.
>
> I see how [JDK-8297389](https://bugs.openjdk.org/browse/JDK-8297389) caused this now but am unclear how to truly fix it. The memory management aspects of all this are extremely convoluted. In the context of [JDK-8297389](https://bugs.openjdk.org/browse/JDK-8297389) if it needs to free a MethodData that it allocated, then I would expect that to be a complete freeing - not sure why it doesn't call the destructor to handle things as that is what the destructor is for.

@dholmes-ora Is that what you were suggesting when you said "not sure why it doesn't call the destructor to handle things as that is what the destructor is for"?

Yes - though as I said the memory management here is so convoluted that it is hard for me to see in detail if that is correct.

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

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


More information about the hotspot-dev mailing list