RFR: 8304074: [JMX] Add an approximation of total bytes allocated on the Java heap by the JVM [v12]

Paul Hohensee phh at openjdk.org
Fri May 12 15:13:02 UTC 2023


On Tue, 9 May 2023 14:30:06 GMT, Volker Simonis <simonis at openjdk.org> wrote:

>> src/hotspot/share/services/threadService.cpp line 224:
>> 
>>> 222: 
>>> 223:   decrement_thread_counts(jt, daemon);
>>> 224:   ThreadService::incr_exited_allocated_bytes(jt->cooked_allocated_bytes());
>> 
>> Again this is too soon. This should be deferred until after the thread has removed itself from the threads-list.
>
> Here I agree. This method (i.e. `ThreadService::current_thread_exiting()`)  is called from `JavaThread::exit()` *before* the call to `Threads::remove()`. I think this call here to `ThreadService::incr_exited_allocated_bytes()` could be removed completely in favor of an unconditional call to `ThreadService::incr_exited_allocated_bytes()` in `ThreadService::remove_thread()` (which will be called by `Threads::remove()` *after* it removed the thread from the thread list). See my comment there.

Done.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13814#discussion_r1192493634


More information about the hotspot-runtime-dev mailing list