[jdk20] RFR: 8298084: Memory leak in Method::build_profiling_method_data
Kim Barrett
kbarrett at openjdk.org
Sun Dec 11 17:34:55 UTC 2022
On Fri, 9 Dec 2022 16:16:00 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
> This change fixes the MethodData leak by calling the destructor in both the release_C_heap_structures conditionally and by calling the MethodData destructor in the MetadataFactory::free_metadata method.
> Thanks to @jcking for working on the patch and discussion.
> Tested with tier1-4.
Changes requested by kbarrett (Reviewer).
src/hotspot/share/memory/metadataFactory.hpp line 79:
> 77: // T is a potentially const or volatile qualified pointer. Remove the pointer and any const
> 78: // or volatile so we can call the destructor of the type T points to.
> 79: using U = typename RemoveCV<typename RemovePointer<T>::type>::type;
Use `std::remove_pointer<T>` and `std::remove_cv<T>` from `<type_traits>` in
preference to our pre-C++11/14 workarounds. You can also avoid `typename` and
`::type` by using the "_t"-suffixed versions. So
using U = std::remove_cv_t<std::remove_pointer_t<T>>;
And "If requested" in the comment? That suggests some conditionalization, of
which there is none. Maybe something like "Most of the cleanup is done via
deallocate_contents, but some types require some additional cleanup via the
destructor."
-------------
PR: https://git.openjdk.org/jdk20/pull/13
More information about the hotspot-dev
mailing list