On Mon, 15 May 2023 23:12:52 GMT, Paul Hohensee <p...@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 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/f5da892e...effdefc6

Changes requested by dholmes (Reviewer).

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.

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

> 226: 
> 227:         // start threads
> 228:         done = false; done1 = false;

Nit: separate lines please

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

PR Review: https://git.openjdk.org/jdk/pull/13814#pullrequestreview-1427697736
PR Review Comment: https://git.openjdk.org/jdk/pull/13814#discussion_r1194595159
PR Review Comment: https://git.openjdk.org/jdk/pull/13814#discussion_r1194595657

Reply via email to