RFR: 8357086: os::xxx functions returning memory size should return size_t [v11]

Thomas Stuefe stuefe at openjdk.org
Mon Jun 16 14:14:30 UTC 2025


On Mon, 16 Jun 2025 09:06:07 GMT, Anton Artemov <duke at openjdk.org> wrote:

> > What caller really needs multiple error codes? We want to know a memory size, and we may get it or not. If we don't get it, I don't think it matters why we don't get it. I don't see any different actions taken _by the caller of os::xxx()_ in reaction to what cog in the machine exactly failed. The end user needs a way to get detail information, but that can be done with UL logging down in the function itself. In addition, for very severe errors the function could end the JVM right away themselves, no need to even return to the caller. Example: if /proc is missing.
> 
> If we don't really need multiple error codes, then having a struct is redundant, as the the **only** error value can be encoded as something like `std::numeric_limits<size_t>::max`. I think it is safe to assume that this value will never be returned as a real memory size on any platform.

Absolutely.

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

PR Comment: https://git.openjdk.org/jdk/pull/25450#issuecomment-2976821640


More information about the hotspot-dev mailing list