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

Daniel D. Daugherty dcubed at openjdk.org
Mon May 8 16:44:36 UTC 2023


On Mon, 8 May 2023 02:13:14 GMT, David Holmes <dholmes at openjdk.org> 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/threadService.cpp line 173:
> 
>> 171:     // was not called, e.g., JavaThread::cleanup_failed_attach_current_thread().
>> 172:     decrement_thread_counts(thread, daemon);
>> 173:     ThreadService::incr_exited_allocated_bytes(thread->cooked_allocated_bytes());
> 
> By doing this here you increase the likelihood of double-accounting for this thread. If you do this after the thread is no longer on any threads-list you may miss its contribution entirely, but you won't double-count it.

If the `thread` is no longer on any ThreadsList, then it is not safe to access `thread`.

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

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


More information about the serviceability-dev mailing list