From: | David Rowley <dgrowleyml(at)gmail(dot)com> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de> |
Cc: | PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Add palloc_aligned() to allow arbitrary power of 2 memory alignment |
Date: | 2022-11-15 10:36:53 |
Message-ID: | CAApHDvqZNwLeKPNxyLi6avGmHLaJr38XsA+LS5UdrcNDgo+Z8Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, 15 Nov 2022 at 11:11, Andres Freund <andres(at)anarazel(dot)de> wrote:
> Couldn't we reduce the amount of over-allocation by a small amount by special
> casing the already-aligned case? That's not going to be relevant for page size
> aligne allocations, but for smaller alignment values it could matter.
I don't quite follow this. How can we know the allocation is already
aligned without performing the allocation? To perform the allocation
we must tell palloc what size to allocate. So, we've already wasted
the space by the time we can tell if the allocation is aligned to what
we need.
Aside from that, there's already a special case for alignto <=
MAXIMUM_ALIGNOF. But we know no palloc will ever return anything
aligned less than that in all cases, which is why that can work.
David
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Gustafsson | 2022-11-15 10:39:20 | Re: Unit tests for SLRU |
Previous Message | Peter Eisentraut | 2022-11-15 10:31:03 | Re: Non-decimal integer literals |