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

Stefan Johansson sjohanss at openjdk.org
Thu Dec 15 10:32:29 UTC 2022


> 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

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

Changes:
  - all: https://git.openjdk.org/jdk20/pull/39/files
  - new: https://git.openjdk.org/jdk20/pull/39/files/16e16b7c..c0edb882

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk20&pr=39&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk20&pr=39&range=00-01

  Stats: 37 lines in 1 file changed: 0 ins; 37 del; 0 mod
  Patch: https://git.openjdk.org/jdk20/pull/39.diff
  Fetch: git fetch https://git.openjdk.org/jdk20 pull/39/head:pull/39

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


More information about the hotspot-gc-dev mailing list