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

Mandy Chung mchung at openjdk.org
Tue May 23 18:29:05 UTC 2023


On Fri, 19 May 2023 13:54:13 GMT, Paul Hohensee <phh at openjdk.org> wrote:

>> Please review this addition to com.sun.management.ThreadMXBean that returns the total number of bytes allocated on the Java heap since JVM launch by both terminated and live threads.
>> 
>> Because this PR adds a new interface method, I've updated the JMM_VERSION to 4, but would be happy to update it to 3_1 instead.
>
> Paul Hohensee has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8304074: atomic load needed in exited_allocated_bytes

The specification looks good.   A minor comment in the test.

src/jdk.management/share/classes/com/sun/management/ThreadMXBean.java line 116:

> 114:      * recorded.
> 115:      *
> 116:      * @implSpec The default implementation throws UnsupportedOperationException

Suggestion:

     * @implSpec The default implementation throws {@code UnsupportedOperationException}

test/jdk/com/sun/management/ThreadMXBean/ThreadAllocatedMemory.java line 160:

> 158:         try {
> 159:             curThread.join();
> 160:         } catch (InterruptedException e) {

should it just let `InterruptedException` be thrown rather than swallowing it?  This pattern appears multiple places in this test and ThreadAllocatedMemoryArray.java test.

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

PR Review: https://git.openjdk.org/jdk/pull/13814#pullrequestreview-1440326691
PR Review Comment: https://git.openjdk.org/jdk/pull/13814#discussion_r1202819575
PR Review Comment: https://git.openjdk.org/jdk/pull/13814#discussion_r1202824396


More information about the serviceability-dev mailing list