RFR: 8304292: Memory leak related to ClassLoader::update_class_path_entry_list [v2]
Calvin Cheung
ccheung at openjdk.org
Thu Aug 10 00:10:28 UTC 2023
On Wed, 9 Aug 2023 21:30:45 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> Calvin Cheung has updated the pull request incrementally with one additional commit since the last revision:
>>
>> add comments to boolean args
>
> src/hotspot/share/classfile/classLoader.cpp line 816:
>
>> 814: if (strcmp(e->name(), entry->name()) == 0) {
>> 815: // entry already exists
>> 816: delete entry;
>
> I think the API contract between `update_class_path_entry_list()` and `add_to_app_classpath_entries()` is too complicated:
>
> - `add_to_app_classpath_entries()` will delete the entry if it decides that the entry shouldn't be saved
>
> It's better for the lifetime of the entry to be maintained by `update_class_path_entry_list()`. It should do something like:
>
>
> new_entry = create_class_path_entry(current, path, &st, is_boot_append, from_class_path_attr);
>
> if (add_to_app_classpath_entries(current, new_entry, check_for_duplicates) == false) {
> // new_entry is not saved, free it now
> delete new_entry;
> }
Thanks for the review. I've pushed another commit based on your suggestions.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15132#discussion_r1289368107
More information about the hotspot-runtime-dev
mailing list