RFR: 8345012: os::build_agent_function_name potentially wastes a byte when allocating the buffer [v3]
David Holmes
dholmes at openjdk.org
Thu Nov 28 12:53:38 UTC 2024
On Thu, 28 Nov 2024 12:35:03 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> src/hotspot/os/posix/os_posix.cpp line 976:
>>
>>> 974: // Total buffer length to allocate - includes null terminator.
>>> 975: len = strlen(sym_name) + (need_underscore ? 1 : 0) + name_len + 1;
>>> 976: agent_entry_name = NEW_C_HEAP_ARRAY_RETURN_NULL(char, len, mtThread);
>>
>> Preexisting: If we fail to allocate memory, we return NULL, which results in various places in confusing "cannot find agent function" messages. Maybe better would be a clear native oom exit here?
>
> That kind of change in functionality is not a part of this PR. Plus it is a moot point as we would never get a native OOM during VM init in any realistic circumstances.
Sorry, you are right - I should have not responded this late at night :) If we are going to abort the VM we should at least report the correct reason.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22404#discussion_r1862127422
More information about the hotspot-runtime-dev
mailing list