RFR: 8297053: Specify new default byte alignment for native allocators
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon Jan 12 13:05:44 UTC 2026
On Sun, 11 Jan 2026 17:11:32 GMT, Igor Rudenko <duke at openjdk.org> wrote:
> Use the largest known value for default allocation alignment so that align value that less than 16 (typical align for modern systems) turns to 16
This PR seems in conflict with the goals of another PR: https://git.openjdk.org/jdk/pull/28235
In that PR (see lengthy discussion) it emerged that in modern C standards, malloc is only constrained to return an alignment that is compatible with the size of the object being allocated. So, when allocating 2 bytes, some malloc implementations are allowed to return a 2-byte aligned address -- that's not against the spec. So, by forcing 16-byte min alignment on everything, we'd end up adding significant additional padding when e.g. preloading the `jemalloc` allocator.
It would be helpful if you could provide some examples of why the current behavior would not be correct on some platforms.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29156#issuecomment-3738451086
More information about the core-libs-dev
mailing list