RFR: 8357086: os::xxx functions returning memory size should return size_t [v5]
Anton Artemov
duke at openjdk.org
Thu Jun 12 08:43:47 UTC 2025
On Wed, 11 Jun 2025 17:12:28 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:
>> And 258 as well. Maybe we don't need the static cast here?
>
> Hmm. Isn't 257 redundant because we already check for this on line 241 and the code between should never set the `avail_mem` to `-1`. Maybe this code needs some extra scrutiny as well (as a follow-up)
Thanks for spotting this. Line 243 definitely needs treatment as well as line 258. Addressed in the latest commit.
Line 257 does not look redundant to me. `avail_mem` could be set to large error value (cast from -1) on line 240, then lines between 246 and 256 can actually left untouched if something went wrong with reading meminfo file. Then we need to check if we still have an error value in `avail_mem`, and if so, use the one returned by `free_memory()`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25450#discussion_r2142071689
More information about the hotspot-dev
mailing list