On Thu, 20 Nov 2025 11:02:32 GMT, Almaz <[email protected]> wrote:

>> I think the proposed simpler patch makes sense. Basically, it artificially 
>> expands the allocation size to match the alignment, which is probably not 
>> going to cause any side-effect as that is likely what was happening anyway...
>
> @mcimadamore:
> 
> Question regarding `MAX_MALLOC_ALIGN = Unsafe.ADDRESS_SIZE == 4 ? 8 : 16;`
> 
> Is 16 here just a heuristic based on known malloc implementations or is it 
> backed by something? I can't find anything regarding that in the libc 
> standard. 
> 
> Not related to this particular PR: should `MAX_MALLOC_ALIGN` be 
> `MIN_MALLOC_ALIGN` instead? Larger allocations might be page size aligned.

> Should I also add [the 
> test](https://github.com/openjdk/jdk/pull/28235#issuecomment-3532821794) 
> suggested by @Yqwed before we conclude this PR, or is it better to leave it 
> for a later one?

I've tested it a bit, but I'm not sure it provides any extra value. It seems to 
only trigger on the same condition as the existing `testActualByteAlignment` 
and `testAlignedAccess` tests in `TestMemoryAlignment.java`..

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

PR Comment: https://git.openjdk.org/jdk/pull/28235#issuecomment-3557849641

Reply via email to