RFR: 8334489: Add function os::used_memory [v2]

Severin Gehwolf sgehwolf at openjdk.org
Wed Jun 19 18:41:09 UTC 2024


On Wed, 19 Jun 2024 16:44:01 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

> `os::free_memory()` is just `available_memory()` on all of our platforms. I thought it was weird that we have two of them which are identical, so I just picked the one that is defined.

That doesn't sound right. `available_memory()` is using `/proc/meminfo` on Linux (`MemAvailable:` key). While `free_memory()` uses `sysinfo`'s `freeram`. They are only identical for the container case where such a thing like `MemAvailable` is not available in the interface files.

TLDR; It's the same on all platforms except Linux.

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

PR Comment: https://git.openjdk.org/jdk/pull/19772#issuecomment-2179299013


More information about the hotspot-runtime-dev mailing list