jmx-dev RFR: 8350939: Revisit Windows PDH buffer size calculation for OperatingSystemMXBean
David Holmes
dholmes at openjdk.org
Tue Mar 4 11:50:54 UTC 2025
On Tue, 4 Mar 2025 08:14:52 GMT, Kevin Walls <kevinw at openjdk.org> wrote:
>> src/jdk.management/windows/native/libmanagement_ext/OperatingSystemImpl.c line 296:
>>
>>> 294: /* PDH format patterns, and lengths of their constant component. */
>>> 295: static const char* const OBJECT_COUNTER_FMT = "\\%s\\%s";
>>> 296: static const size_t OBJECT_COUNTER_FMT_LEN = 2;
>>
>> Pre-existing but as per earlier discussions on this, what exactly do these lengths mean??
>
> Yes was trying to clarify that with the comment: the "constant component", the number of fixed characters. So allocation size is e.g. OBJECT_COUNTER_FMT_LEN (==2) to account for the two backslashes in that format. The lengths of the two strings, plus the terminator, are added in the method that constructs the counter path..
Ah! Makes sense now. :)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23861#discussion_r1979271076
More information about the jmx-dev
mailing list