RFR: 8371637: allocateNativeInternal sometimes return incorrectly aligned memory [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Nov 14 14:52:14 UTC 2025


On Fri, 14 Nov 2025 10:54:39 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

> The VM (which the JDK interfaces with malloc through) guarantees at-most 16 byte alignment from `malloc`, so any alignment less than that is also going to be fine. We should, as always, test this, but I don't think that anything will break on the VM side with this change.

Note that, since this is just a change on a Java API, I don't think should affect the VM? Then of course if someone runs java in an environment with LD_PRELOAD where jemalloc is used instead of malloc, and _all_ allocation (even ones from native code) aligns differently, I can't speak on how that would impact the JVM.

But this change, alone, should not impact the VM in any way?

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

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


More information about the core-libs-dev mailing list