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

Stefan Karlsson stefank at openjdk.org
Wed Jun 11 17:15:31 UTC 2025


On Wed, 11 Jun 2025 17:08:54 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> src/hotspot/os/linux/os_linux.cpp line 261:
>> 
>>> 259:   }
>>> 260:   log_trace(os)("available memory: " JULONG_FORMAT, avail_mem);
>>> 261:   return static_cast<size_t>(avail_mem);
>> 
>> Line 243 should probably receive the same treatment (of `static_cast`)?
>
> 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)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25450#discussion_r2140698836


More information about the hotspot-dev mailing list