RFR: 8371637: allocateNativeInternal sometimes return incorrectly aligned memory

Harald Eilertsen haraldei at openjdk.org
Tue Nov 11 15:54:01 UTC 2025


On Tue, 11 Nov 2025 15:32:14 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> Are you saying that jemalloc aligns allocations that are _exactly_ 16 bytes on an 8 byte boundary? 

No. A 16 byte allocation will fall on a 16 byte boundary. But a 8 byte or smaller allocation will fall on a 8 byte boundary. And since the original code would not adjust the size if `byteAlignment` was exactly 16, this would mean that the requested alignment was not honoured. This caused the `TestMemoryAlignment` test to fail intermittently for exacrly 16 byte alignment requests. For all other valid values of `byteAlignment` the alignment would be as expected.

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

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


More information about the core-libs-dev mailing list