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

Kim Barrett kbarrett at openjdk.org
Wed Jun 11 12:30:33 UTC 2025


On Wed, 11 Jun 2025 09:53:17 GMT, Anton Artemov <duke at openjdk.org> wrote:

>> Hi,
>> 
>> in this PR the output value type for functions which return memory are changed, namely:
>> 
>> 
>> static julong available_memory(); --> static size_t available_memory();
>> static julong used_memory(); --> static size_t used_memory();
>> static julong free_memory(); --> static size_t free_memory(); 
>> static jlong total_swap_space(); --> static ptrdiff_t total_swap_space();
>> static jlong free_swap_space(); --> static ptrdiff_t free_swap_space(); 
>> static julong physical_memory(); --> static size_t physical_memory(); 
>> 
>> 
>> The changes are done so that the other parts of the code have minimal impact. 
>> Tested in GHA and Tiers 1-4.
>
> Anton Artemov has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 12 additional commits since the last revision:
> 
>  - Merge remote-tracking branch 'origin/master' into JDK-8357086_size_t_memfuncs
>  - 8357086: Fixed spaces in formatting in gc-related code.
>  - 8357086: Fixed formatting.
>  - 8357086: Addressed reviewer's comments.
>  - 8357086: More work.
>  - 8357086: More work.
>  - 8357086: More work.
>  - 8357086: More work.
>  - 8357086: More work.
>  - 8357086: More work
>  - ... and 2 more: https://git.openjdk.org/jdk/compare/430aa5b8...f3a5f61c

Windows doesn't seem to have ssize_t natively, so we define it and SSIZE_MAX and SSIZE_MIN ourselves
(in globalDefinitions_visCPP.hpp), with the obvious definitions.

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

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


More information about the hotspot-dev mailing list