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

From: Paul Eggert
Date: Sat Feb 08 2025 - 15:18:13 EST


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.