On Mon, 8 May 2023 02:10:48 GMT, David Holmes <[email protected]> wrote:
>> Paul Hohensee has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> 8304074: [JMX] Add an approximation of total bytes allocated on the Java
>> heap by the JVM
>
> src/hotspot/share/services/management.cpp line 2107:
>
>> 2105: // when result is initialized.
>> 2106: jlong result = ThreadService::exited_allocated_bytes();
>> 2107: for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread =
>> jtiwh.next();) {
>
> If you call `exited_allocated_bytes` whilst you have an active
> `ThreadsListHandle` then you at least ensure you don't miss accounting for
> threads that are just about to terminate.
Do you mean something like:
JavaThreadIteratorWithHandle jtiwh;
jlong result = ThreadService::exited_allocated_bytes();
while (JavaThread *thread = jtiwh.next()) {
...
That would be fine for me. Otherwise I agree with the current compromise
between accuracy and speed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13814#discussion_r1187488276