RFR: 8367485: os::physical_memory is broken in 32-bit JVMs when running on 64-bit OSes [v11]

Severin Gehwolf sgehwolf at openjdk.org
Thu Sep 25 09:21:43 UTC 2025


On Thu, 25 Sep 2025 09:17:57 GMT, Anton Artemov <duke at openjdk.org> wrote:

>> Hi, please consider the following changes:
>> 
>> In this PR we address the overflow issue in `os::physical_memory()` on Linux, which can occur when running a 32-bit JVM on a 64-bit machine, introduced by https://bugs.openjdk.org/browse/JDK-8357086. The problem is that the product of _SC_PHYS_PAGES and _SC_PAGESIZE can overflow according to the documentation. 
>> 
>> The issue is addressed by changing the output type of all related functions to `uint64_t`.
>> 
>> Tested in tiers 1 - 5.
>
> Anton Artemov has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - 8367485: Eliminated uint64_t
>  - 8367485: Typedef alias for uint64_t used in mem funcs.

src/hotspot/os/aix/os_aix.cpp line 2195:

> 2193: 
> 2194:   trcVerbose("processor count: %d", os::_processor_count);
> 2195:   trcVerbose("physical memory: " UINT64_FORMAT, Aix::_physical_memory);

Should there be a `PHYS_MEM_TYPE_FORMAT` define as well. In case the format needs changing from `UINT64_FORMAT`?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27335#discussion_r2378392610


More information about the hotspot-dev mailing list