On Tue, 24 Mar 2026 10:37:23 GMT, Roman Kennke <[email protected]> wrote:
>> src/hotspot/os/windows/os_windows.cpp line 1069: >> >>> 1067: // Windows APIs require NUL-terminated strings; the name pointer >>> 1068: // may not be NUL-terminated, so copy into a local buffer. >>> 1069: char stack_buf[256]; >> >> Where does 256 limit come from? > > Educated guess? E.g. how long can thread-names realistically be, and how much > can we realistically allocate on-stack? It's not a limit - when the string > really is longer, then we allocate a temporary buffer on heap. @rkennke Sorry, I misunderstood you; I thought the 256 is the hard limit. I looked it up, the limit is 32K of UCS2 characters. Bit large for a thread stack. In that case, it would be better to use @dholmes-ora original proposal of `stringStream ss(K * 32)`; Note that it will get converted to unicode below and copied at least once again. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/30374#discussion_r3025961448
