Re: pgsql: Generational memory allocator - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: Generational memory allocator
Date
Msg-id 13547.1511474676@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Generational memory allocator  (Andres Freund <andres@anarazel.de>)
Responses Re: pgsql: Generational memory allocator  (Tomas Vondra <tv@fuzzy.cz>)
Re: pgsql: Generational memory allocator  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-committers
Andres Freund <andres@anarazel.de> writes:
> On 2017-11-23 22:34:57 +0100, Tomas Vondra wrote:
>> Hmmm, I see. Presumably adding this to GenerationChunk (similarly to what we
>> do in AllocChunkData) would address the issue:
>>
>> #if MAXIMUM_ALIGNOF > 4 && SIZEOF_VOID_P == 4
>> Size        padding;
>> #endif
>>
>> but I have no way to verify that (no access to such machine). I wonder why
>> SlabChunk doesn't need to do that (perhaps a comment explaining that would
>> be appropriate?).

> Can't you just compile pg on a 32bit system and manually define MAXALIGN
> to 8 bytes?

I pushed a patch that computes how much padding to add and adds it.
(It might not really work if size_t and void * are different sizes,
because then there could be additional padding in the struct; but
that seems very unlikely.)
        regards, tom lane


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Ensure sizeof(GenerationChunk) is maxaligned.
Next
From: Tomas Vondra
Date:
Subject: Re: pgsql: Generational memory allocator