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

Kevin Walls kevinw at openjdk.org
Thu May 25 09:04:13 UTC 2023


On Tue, 23 May 2023 02:29:19 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: atomic load needed in exited_allocated_bytes
>
> src/hotspot/share/services/management.cpp line 2104:
> 
>> 2102:     // the final result can only be short due to (1) threads that start after
>> 2103:     // the TLH is created, or (2) terminating threads that escape TLH creation
>> 2104:     // and don't update exited_allocated_bytes before we initialize result.
> 
> Okay this is why you can't do monotonicity check in the tests. Imagine we have 10 threads all live and we call this function and so tally up all 10 threads. The next time we call this 5 of the threads are in the process of terminating - they have escaped the TLH but not yet updated the exited_allocated_bytes - so now we only tally up 5 threads and so the total appears to be far less than last time.

The tests and all apps might thank us for keeping last known value, and not returning anything lower, ensuring montonicity.

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

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


More information about the serviceability-dev mailing list