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

Anton Artemov duke at openjdk.org
Wed Jul 30 14:28:18 UTC 2025


On Tue, 29 Jul 2025 10:53:53 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> Anton Artemov has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 12 commits:
>> 
>>  - 8357086: Fxied return value
>>  - 8357086: Fixed whitespaces
>>  - 8357086: Introduced usage pattern
>>  - 8357086: Fixed typo
>>  - 8357086: Refactored physical_memory in different OS
>>  - 8357086: Small fixes 2
>>  - 8357086: Small fixes 1.
>>  - 8357086: Refactored physical_memory()
>>  - 8357086: Refactored free_swap_space()
>>  - 8357086: Refactored total_swap_space()
>>  - ... and 2 more: https://git.openjdk.org/jdk/compare/75ce44aa...e4698333
>
> src/hotspot/os/bsd/os_bsd.cpp line 1482:
> 
>> 1480:   size_t avail_mem = 0;
>> 1481:   if (!os::available_memory(avail_mem))
>> 1482:   {
> 
> Suggestion:
> 
>   if (!os::available_memory(avail_mem)) {

Addressed.

> src/hotspot/os/windows/os_windows.cpp line 900:
> 
>> 898:   size_t phys_mem = win32::physical_memory();
>> 899:   if (phys_mem == std::numeric_limits<size_t>::max())
>> 900:   {
> 
> Suggestion:
> 
>   if (phys_mem == std::numeric_limits<size_t>::max()) {

Thanks, addressed.

> src/hotspot/share/gc/z/zLargePages.cpp line 37:
> 
>> 35:     log_debug_p(gc, init)("os::physical_memory() failed");
>> 36:   }
>> 37:   log_info_p(gc, init)("Memory: %zuM", phys_mem / M);
> 
> I have the same comment about this change as I have for `GCInitLogger::print_memory`.

Thanks, addressed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25450#discussion_r2242885773
PR Review Comment: https://git.openjdk.org/jdk/pull/25450#discussion_r2242887388
PR Review Comment: https://git.openjdk.org/jdk/pull/25450#discussion_r2242889176


More information about the hotspot-dev mailing list