RFR: 8347758: modules.cpp leaks string returned from get_numbered_property_as_sorted_string() [v4]
Ioi Lam
iklam at openjdk.org
Wed Jan 15 22:24:36 UTC 2025
On Wed, 15 Jan 2025 19:22:50 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:
>> Modules::get_numbered_property_as_sorted_string() returns strings created from os::strdup(), callers should free them after uses.
>
> Zhengyu Gu has updated the pull request incrementally with one additional commit since the last revision:
>
> Assertion in wrong place
src/hotspot/share/classfile/modules.cpp line 639:
> 637:
> 638: const char* Modules::get_native_access_flags_as_sorted_string() {
> 639: assert(Thread::current()->current_resource_mark() != nullptr, "Setup by caller");
I think these asserts are redundant. st.as_string() will fail if there are no resource marks. We have plenty of functions that return a resurce-allocated object and it's uncommon to add such asserts.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23121#discussion_r1917413502
More information about the hotspot-runtime-dev
mailing list