On Thu, 20 Nov 2025 14:42:47 GMT, Almaz <[email protected]> wrote: > > Yes, because I think that's where this "trick" came from in the first place. > > Doesn't existence of this PR implies that hotspot is running in GNU libc > non-conformant environments? With this patch applied `MAX_MALLOC_ALIGN` will > assume GNU libc and at the same time there will be `allocationSize = > Math.max(alignedSize, byteAlignment);` which is a workaround for cases where > GNU libc guarantess do not hold. > > Wouldn't it be safer to code against WG14's version?
Note that WG14 still defines a max alignment: `max_align_t` > which is an object type whose alignment is the greatest fundamental alignment; So the question is: what is the greatest fundamental alignment? If you follow the rules for fundamental alignment, I think it you end up in the same place -- e.g. fundamental alignment in C is same as "natural" layout in out layout API, and it's ultimately driven by the alignment of the scalar types. So we're back to "what is the biggest scalar type we can express in that platform" ? The difference between libc and WG14 is not in the fact that some max guaranteed alignment exists. It's in the fact that libc guarantees that _all malloc calls will be aligned to that max alignment_ whereas WG14 does not (unless when you hold it at a certain angle ;-) ) ------------- PR Comment: https://git.openjdk.org/jdk/pull/28235#issuecomment-3559241856
