RFR: 8376302: os::Machine::used_memory reports container used memory when running containerized

Casper Norrbin cnorrbin at openjdk.org
Mon Jan 26 12:23:57 UTC 2026


Hi everyone,

In #27646, I introduced interfaces to get machine and container values separately when running inside a container. For `os::used_memory`, I initially moved the container check out of the function, and the remainder became `os::Machine::used_memory`. However, this function was still calling the "normal" `os::` functions, which resulted in the container check being performed again. This was incorrect. I have now updated these calls to use the appropriate `os::Machine::` functions, which do not re-check for containerization. The behaviour of `os::used_memory` itself remains unchanged, as it does the container check before delegating to the `Machine` function.

Testing:
- Oracle tier 1
- Manual testing to see that the value works correctly

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

Commit messages:
 - fix

Changes: https://git.openjdk.org/jdk/pull/29413/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29413&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8376302
  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/29413.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29413/head:pull/29413

PR: https://git.openjdk.org/jdk/pull/29413


More information about the hotspot-runtime-dev mailing list