RFR: JDK-8374395 : Improve MemoryUsage.toString() and constructor error messages for better clarity
eunbin son
duke at openjdk.org
Tue Dec 30 22:45:24 UTC 2025
### Summary
MemoryUsage.toString() now displays "N/A" for undefined init and max values (-1) instead of "-1(-1K)".
This addresses the first of three issues in JDK-8374395.
### Description
When init or max is -1 (undefined), toString() outputs "-1(-1K)". The Javadoc states that -1 means undefined, but the output does not clearly indicate this.
toString() checks if init or max equals -1 and outputs "init = N/A" or "max = N/A" respectively. Output format for valid values remains unchanged.
Added test cases to the existing jtreg test file. All tests pass.
Bug-ID : JDK-8374395
https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8374395
-------------
Commit messages:
- Update full name
- 8374395: Clarify undefined values in MemoryUsage.toString()
Changes: https://git.openjdk.org/jdk/pull/29009/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29009&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8374395
Stats: 100 lines in 2 files changed: 96 ins; 0 del; 4 mod
Patch: https://git.openjdk.org/jdk/pull/29009.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29009/head:pull/29009
PR: https://git.openjdk.org/jdk/pull/29009
More information about the serviceability-dev
mailing list