RFR: JDK-8298084: Memory leak in Method::build_profiling_method_data
Tobias Hartmann
thartmann at openjdk.org
Wed Dec 7 09:18:05 UTC 2022
On Wed, 7 Dec 2022 08:47:38 GMT, Justin King <jcking at openjdk.org> wrote:
>> src/hotspot/share/oops/method.cpp line 602:
>>
>>> 600:
>>> 601: if (!Atomic::replace_if_null(&method->_method_data, method_data)) {
>>> 602: method_data->release_C_heap_structures();
>>
>> What about leaving the `_extra_data_lock` as is and explicitly calling `~MethodData()` here?
>
> We can, but in general calling a member function after calling a destructor is likely undefined behavior. The lifetime of the object has ended.
Right, I thought that it wouldn't make things worse because we already call the destructor in current code, but here we call `free_metadata` right after which performs all kinds of accesses on `method_data`. Not an option then.
@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"?
-------------
PR: https://git.openjdk.org/jdk/pull/11526
More information about the hotspot-dev
mailing list