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

Casper Norrbin cnorrbin at openjdk.org
Tue Jan 27 12:37:23 UTC 2026


On Mon, 26 Jan 2026 12:16:19 GMT, Casper Norrbin <cnorrbin at openjdk.org> wrote:

> 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

Thank you for the quick reviews!

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

PR Comment: https://git.openjdk.org/jdk/pull/29413#issuecomment-3804972230


More information about the hotspot-runtime-dev mailing list