jmx-dev RFR: 8304074: [JMX] Add an approximation of total bytes allocated on the Java heap by the JVM [v28]

David Holmes dholmes at openjdk.org
Mon May 29 02:10:12 UTC 2023


On Fri, 26 May 2023 16:41:32 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 with a new target base due to a merge or a rebase. The pull request now contains 100 commits:
> 
>  - 8304074: Remove extra file
>  - 8304074: Add getTotalAllocatedBytes high water mark
>  - Merge branch 'master' into 8304074
>  - 8304074: Refactor test exception handling
>  - Merge master
>  - Merge master
>  - 8304074: Change UnsupportedOperationException in javadoc comment to {@code UnsupportedOperationException}
>  - 8306507: [linux] Print number of memory mappings in error reports
>    
>    Reviewed-by: adinn, sgehwolf
>  - 8300086: Replace NULL with nullptr in share/c1/
>    
>    Reviewed-by: thartmann, chagedorn
>  - 8308465: Reduce memory accesses in AArch64 MD5 intrinsic
>    
>    Reviewed-by: aph, phh
>  - ... and 90 more: https://git.openjdk.org/jdk/compare/77c5adb0...5f2f86bb

High watermark changes seem fine in principle but not sure about borrowing the `MonitoringSupport_lock ` to do the locking. At a minimum this comment should be expanded:

./share/runtime/mutexLocker.hpp:extern Mutex*   MonitoringSupport_lock;          // Protects updates to the serviceability memory pools.

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

> 303:     }
> 304: 
> 305:     private static void reportUnexpected(Exception e, String reason) {

nit: 'when' or 'where' seems a more appropriate name than 'reason'

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

PR Review: https://git.openjdk.org/jdk/pull/13814#pullrequestreview-1448631761
PR Review Comment: https://git.openjdk.org/jdk/pull/13814#discussion_r1208763752


More information about the jmx-dev mailing list