[jdk20] RFR: 8297979: ZGC: Ensure consistent MemoryUsage from MemoryMXBean.getHeapMemoryUsage() [v2]

Albert Mingkun Yang ayang at openjdk.org
Thu Dec 15 13:14:08 UTC 2022


On Thu, 15 Dec 2022 10:32:29 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:

>> Please review this bugfix to ensure a consistent `MemoryUsage`object is returned when using `MemoryMXBean.getHeapMemoryUsage()`
>> 
>> **Summary**
>> In ZGC the `MemoryUsage` returned was created using the base implementation in `CollectedHead`. This implementation just queries the underlying heap for `used`, `capacity`and `max_capacity`, and since these values can be updated concurrently with ZGC we need to have a specialized implementation that handles this to ensure consistent values are returned. Such implementation is already present and used when the usage is quired through a `MemoryPool`, so this change just re-uses that.
>> 
>> **Testing**
>> Verified locally that this fixes the test that previously failed.
>
> Stefan Johansson has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update ProblemList

Marked as reviewed by ayang (Reviewer).

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

PR: https://git.openjdk.org/jdk20/pull/39


More information about the hotspot-gc-dev mailing list