[PATCH v3 4/4] malloc: alignment might change in future versions

Wilco Dijkstra Wilco.Dijkstra@arm.com
Fri Feb 13 16:28:59 GMT 2026


Hi Paul,

> This follows up on a comment by Wilco Dijkstra; see:
> https://sourceware.org/pipermail/libc-alpha/2026-February/174934.html
> * NEWS: Mention this.
> * manual/lang.texi (Important Data Types):
> Say that alignof (max_align_t) might change.
> * manual/memory.texi (Malloc Examples):
> Say that alignment guarantee might change for small allocations.

Looks good to me.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>

Cheers,
Wilco


> +++ b/manual/lang.texi
> @@ -597,7 +597,7 @@ types have a fundamental alignment and lack stricter alignment specifiers.
> In @theglibc{}, the value of @code{alignof (max_align_t)} is 16 on
> most architectures.  However, it is 8 on 32-bit architectures that do
> not require 16-byte alignment from @code{malloc} to support predefined
> -types.
> +types.  The value may change in future releases.
 
OK (this includes increasing alignment, eg. for larger blocks).

> -In @theglibc{}, the block that @code{malloc} gives you is guaranteed
> -to be aligned so that its address is a multiple of
> +In the current release of @theglibc{}, the block that @code{malloc} gives you is
> +aligned so that its address is a multiple of
> @code{alignof (max_align_t)}, so that it can hold object types
>  with any fundamental alignment and without stricter alignment specifiers.

OK

> Only rarely is any higher boundary (such as a page
> boundary) necessary; for those cases, use @code{aligned_alloc} or
> @code{posix_memalign} (@pxref{Aligned Memory Blocks}).
>+Future releases of @theglibc{} may relax alignment for small allocations,
>+so long as any object with fundamental alignment that fits in the small
>+allocation will be properly aligned.  For example, a future @code{malloc (1)}
>+might return a pointer with odd alignment.

OK.


More information about the Libc-alpha mailing list