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

Anton Artemov duke at openjdk.org
Wed May 28 11:06:57 UTC 2025


On Wed, 28 May 2025 09:42:11 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> Anton Artemov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8357086: Addressed reviewer's comments.
>
> src/hotspot/os/bsd/os_bsd.cpp line 180:
> 
>> 178: }
>> 179: 
>> 180: size_t os::total_swap_space() {
> 
> Do you need to cast the `-1`in the changed functions in this file?

Thanks for spotting this! Indeed, two methods should return ptrdiff_t, as their usage logic includes negative values. I addressed this issue in the latest commit.

> src/hotspot/os/linux/cgroupSubsystem_linux.cpp line 673:
> 
>> 671:   }
>> 672:   size_t phys_mem = os::Linux::physical_memory();
>> 673:   log_trace(os, container)("total physical memory: " "%zu", phys_mem);
> 
> Suggestion:
> 
>   log_trace(os, container)("total physical memory: %zu", phys_mem);

Addressed in the latest commit.

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

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


More information about the hotspot-dev mailing list