Re: [PATCH v2] rust: alloc: satisfy `aligned_alloc` requirements

Paul Eggert
2025-02-08T20:18:03Z

On 2025-02-08 11:19, Alejandro Colomar wrote:
> I wonder why glibc silently overaligns aligned_alloc() without reporting
> an error for an alignment of 2, while it reports an error for an
> alignment of 3. It doesn't make much sense at first glance.

Why doesn't it make sense?

If the underlying memory management system supports only some
power-of-two alignments including one alignment greater than 2, it is
easy to support alignment of 2 by overaligning, but it is not possible
to support an alignment of 3.