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

David Holmes dholmes at openjdk.org
Tue Dec 6 07:05:11 UTC 2022


On Tue, 6 Dec 2022 06:13:23 GMT, Justin King <jcking 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'm somewhat confused by the existing code. We have:

// Destroy MethodData
method_data()->~MethodData();

which doesn't actually delete the `MethodData` it just runs the destructor. So where is the `MethodData` object actually allocated, and when is that freed? I would expect the lock to disappear at the same time if it is embedded in the `MethodData` object.

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

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


More information about the hotspot-dev mailing list