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

Anton Artemov duke at openjdk.org
Tue Jun 17 10:19:12 UTC 2025


> Hi,
> 
> in this PR the output value type for functions which return memory are changed, namely:
> 
> 
> static julong available_memory(); --> static MemRes available_memory();
> static julong used_memory(); --> static MemRes used_memory();
> static julong free_memory(); --> static MemRes free_memory(); 
> static jlong total_swap_space(); --> static MemRes total_swap_space();
> static jlong free_swap_space(); --> static MemRes free_swap_space(); 
> static julong physical_memory(); --> static MemRes physical_memory(); 
> 
> 
> `MemRes` is a struct containing a pair of values, `size_t value` to carry the return value, `int error` to carry the error if any. Currently, in case of error the latter is set to -1.
> 
> 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 pull request now contains 20 commits:

 - Merge remote-tracking branch 'origin/master' into JDK-8357086_size_t_memfuncs
 - 8357086: Added default val to constructor of MemRes.
 - 8357086: Addressed the reviewers comments.
 - 8357086: Fixed merge conflict.
 - 8357086: Changed returm type to struct.
 - 8357086: Return size_t from swap mem funcs, added checks.
 - 8357086: Added missed casts.
 - 8357086: Changed return type for total_swap_space and free_swap_space to ssize_t
 - Merge remote-tracking branch 'origin/master' into JDK-8357086_size_t_memfuncs
 - 8357086: Fixed spaces in formatting in gc-related code.
 - ... and 10 more: https://git.openjdk.org/jdk/compare/a0820828...cb762465

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

Changes: https://git.openjdk.org/jdk/pull/25450/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25450&range=11
  Stats: 205 lines in 22 files changed: 46 ins; 2 del; 157 mod
  Patch: https://git.openjdk.org/jdk/pull/25450.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25450/head:pull/25450

PR: https://git.openjdk.org/jdk/pull/25450


More information about the hotspot-dev mailing list