RFR: 8351334: [ubsan] memoryReserver.cpp:552:60: runtime error: applying non-zero offset 1073741824 to null pointer [v11]
David Holmes
dholmes at openjdk.org
Thu Nov 20 05:18:57 UTC 2025
On Wed, 19 Nov 2025 13:48:41 GMT, Afshin Zafari <azafari at openjdk.org> wrote:
>> src/hotspot/share/memory/memoryReserver.cpp line 590:
>>
>>> 588:
>>> 589: // zerobased: Attempt to allocate in the lower 32G.
>>> 590: size_t zerobased_max = OopEncodingHeapMax;
>>
>> Again not obvious what this improves. We obviously have very inconsistent use of types here in that we loosely use `char*`, `uint64_t` and `size_t` to all mean a 64-bit unsigned value, ansd no matter what types we use in the declarations we have to cast something somewhere.
>
> According to reviewers' suggestions, the pointers used in arithmeitc are typed as numeric like `size_t` or `uintptr_t`. And only when they are going to be passed as pointers to other functions, they will be cast to the desired pointers.
Okay but why `size_t` in places and `uintptr_t` in others? In this case `zerobased_max` seems an address not a size - similar to `highest_start` and `lowest_start` in the other part of the change. But then `OopEncodingHeapMax` is `uint64_t` so why not use that?
I'm just not seeing the rules that are being applied here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26955#discussion_r2544365753
More information about the hotspot-gc-dev
mailing list