Withdrawn: 8357086: os::xxx functions returning memory size should return size_t
Anton Artemov
duke at openjdk.org
Wed Jun 25 08:17:42 UTC 2025
On Mon, 26 May 2025 12:56:26 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 bool available_memory(size_t& value);
> static julong used_memory(); --> static bool used_memory(size_t& value);
> static julong free_memory(); --> static bool free_memory(size_t& value);
> static jlong total_swap_space(); --> static bool total_swap_space(size_t& value);
> static jlong free_swap_space(); --> static bool free_swap_space(size_t& value);
> static julong physical_memory(); --> static bool physical_memory(size_t& value);
>
>
> The return boolean value indicates success, whereas the actual value is assigned to the input argument. The following usage pattern is added: value is initialized to zero -> method call -> in case of a failure `os::abort()` is executed.
>
> `physical_memory()` has slightly different mechanism, as the `_physical_memory` variable is assigned in different methods on different operating systems, `std::numeric_limits<size_t>::max()` value is used to indicate an error.
>
> Later, the return value should be attributed with `[[nodiscard]]`.
>
> Tested in GHA and Tiers 1-4.
This pull request has been closed without being integrated.
-------------
PR: https://git.openjdk.org/jdk/pull/25450
More information about the hotspot-dev
mailing list