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

Justin King jcking at openjdk.org
Thu Dec 8 08:19:29 UTC 2022


On Wed, 7 Dec 2022 09:14:16 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

>> 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"?

Copying reply from below.

> 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