RFR: 8256256: UL should not use heap allocation for output string [v4]

Yumin Qi minqi at openjdk.java.net
Tue Dec 1 05:38:57 UTC 2020


On Tue, 1 Dec 2020 04:46:43 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Yumin Qi has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix Copyright year
>
> src/hotspot/share/logging/logTagSet.cpp line 139:
> 
>> 137:       log(level, newbuf);
>> 138:       ::free(newbuf);
>> 139:     } else {
> 
> If we failed to allocate newbuf the existing buf is already filled with everything we need. Can't we just overwrite the last part with the "truncated" message rather than re-doing the whole thing?

line 124:  When buf is small, buf is filled with whatever truncated string with format to get the length needed for new buffer, it does not include prefix. The new version keeps prefix and the buf ends with "..(truncated), native OOM" even if prefix already overflows buf.

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

PR: https://git.openjdk.java.net/jdk/pull/1246


More information about the hotspot-runtime-dev mailing list