[libc-commits] [libc] [libc][malloc] Ensure a minimum block alignment of 4 (PR #169447)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Tue Nov 25 05:58:48 PST 2025


jhuber6 wrote:

The consensus around allocation alignments is a little weird, its not specified in the standard anywhere. Generally, dynamic memory is supposed to be aligned to the largest memory required by a primitive type, i.e. `16` bytes for an x87 long double. However, this wastes a lot of space and isn't required for all cases, so some implementations lower this. At some point LLVM tried  to codify that returned pointers from malloc were aligned but that broke a lot of uses of jemalloc and other optimized allocators that tried to save memory.

https://github.com/llvm/llvm-project/pull/169447


More information about the libc-commits mailing list