RFR: 8304074: [JMX] Add an approximation of total bytes allocated on the Java heap by the JVM [v23]
David Holmes
dholmes at openjdk.org
Tue May 23 02:24:04 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
Sorry I ran this through our CI and I see the test fail on macos-x64:
Done sleeping
AgentVMThread Previous allocated bytes = 66897992 Current allocated bytes = 81305216
AgentVMThread Previous allocated bytes = 81305216 Current allocated bytes = 78425048
----------System.err:(12/778)----------
java.lang.RuntimeException: TEST FAILED: AgentVMThread previous allocated bytes = 81305216 > current allocated bytes = 78425048
at ThreadAllocatedMemory.checkResult(ThreadAllocatedMemory.java:296)
at ThreadAllocatedMemory.testGetTotalThreadAllocatedBytes(ThreadAllocatedMemory.java:276)
at ThreadAllocatedMemory.main(ThreadAllocatedMemory.java:59)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:333)
at java.base/java.lang.Thread.run(Thread.java:1583)
Not sure if the issue is the test or the implementation.
-------------
Changes requested by dholmes (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/13814#pullrequestreview-1438159195
More information about the serviceability-dev
mailing list