[jdk20] Integrated: 8297979: ZGC: Ensure consistent MemoryUsage from MemoryMXBean.getHeapMemoryUsage()
Stefan Johansson
sjohanss at openjdk.org
Fri Dec 16 08:09:10 UTC 2022
On Thu, 15 Dec 2022 10:09:22 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.
This pull request has now been integrated.
Changeset: c47e64e4
Author: Stefan Johansson <sjohanss at openjdk.org>
URL: https://git.openjdk.org/jdk20/commit/c47e64e4f3be80f434dd4dea9b6e8d282b2c2b32
Stats: 43 lines in 3 files changed: 6 ins; 37 del; 0 mod
8297979: ZGC: Ensure consistent MemoryUsage from MemoryMXBean.getHeapMemoryUsage()
Reviewed-by: stefank, ayang
-------------
PR: https://git.openjdk.org/jdk20/pull/39
More information about the hotspot-gc-dev
mailing list