RFR: 8358799: Refactor os::jvm_path() [v2]

David Holmes dholmes at openjdk.org
Tue Jun 10 13:01:29 UTC 2025


On Tue, 10 Jun 2025 01:29:06 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

>> src/hotspot/os/posix/os_posix.cpp line 1071:
>> 
>>> 1069:     assert(false, "must use a large-enough buffer");
>>> 1070:     buf[0] = '\0';
>>> 1071:     return;
>> 
>> Do we need release the memory of `buf` before return, such like
>> 
>> 
>> free(buf);
>
> No, because the caller of the function still references `buf` after the function returns, e.g. in `os::init_system_properties_values()`.

More specifically, `buf` is owned by the caller and we have no idea what it is so we have no business "releasing" it.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25675#discussion_r2137839159


More information about the hotspot-runtime-dev mailing list