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

Paul Hohensee phh at openjdk.org
Thu May 18 12:45:03 UTC 2023


On Tue, 16 May 2023 04:34:29 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Paul Hohensee has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 26 additional commits since the last revision:
>> 
>>  - 8304704: _exited_allocated_bytes increment does not have to be atomic
>>  - Merge branch 'master' into 8304074
>>  - 8304704: _exited_allocated_bytes increment does not have to be atomic
>>  - 8304704: In getTotalThreadAllocatedBytes javadoc, 'launched' -> 'started'
>>  - 8304704: Typos
>>  - 8304074: fetch_then_add, not fetch_and_add
>>  - 8304074: Assign to _add_long_func in add_long_bootstrap
>>  - Merge branch 'master' into 8304074
>>  - 8304074: Define FULL_MEM_BARRIER for linux_arm
>>  - 8304074: set _atomic_add_long_entry = ShouldNotCallThisStub()
>>  - ... and 16 more: https://git.openjdk.org/jdk/compare/1517b64a...effdefc6
>
> src/hotspot/share/services/threadService.hpp line 113:
> 
>> 111:     // No need for atomicity, method is called under the Threads_lock
>> 112:     _exited_allocated_bytes += size;
>> 113:   }
> 
> As there is a lock-free read however you need to use Atomic::load and Atomic::store - especially for 32-bit systems.

Changed. Not sure atomic load is needed.

> test/jdk/com/sun/management/ThreadMXBean/ThreadAllocatedMemory.java line 228:
> 
>> 226: 
>> 227:         // start threads
>> 228:         done = false; done1 = false;
> 
> Nit: separate lines please

Fixed.

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

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


More information about the jmx-dev mailing list