mirror of
https://github.com/postgres/postgres.git
synced 2025-05-20 00:03:14 -04:00
Make slab allocator work on platforms with MAXIMUM_ALIGNOF < sizeof(int).
Notably, m68k only needs 2-byte alignment. Per report from Christoph Berg. Discussion: https://www.postgresql.org/message-id/20170517193957.fwntkgi6epuso5l2@msg.df7cb.de
This commit is contained in:
parent
3ec76ff1f2
commit
94884e1c27
@ -194,9 +194,9 @@ SlabContextCreate(MemoryContext parent,
|
|||||||
MAXALIGN(sizeof(SlabChunk)),
|
MAXALIGN(sizeof(SlabChunk)),
|
||||||
"padding calculation in SlabChunk is wrong");
|
"padding calculation in SlabChunk is wrong");
|
||||||
|
|
||||||
/* otherwise the linked list inside freed chunk isn't guaranteed to fit */
|
/* Make sure the linked list node fits inside a freed chunk */
|
||||||
StaticAssertStmt(MAXIMUM_ALIGNOF >= sizeof(int),
|
if (chunkSize < sizeof(int))
|
||||||
"MAXALIGN too small to fit int32");
|
chunkSize = sizeof(int);
|
||||||
|
|
||||||
/* chunk, including SLAB header (both addresses nicely aligned) */
|
/* chunk, including SLAB header (both addresses nicely aligned) */
|
||||||
fullChunkSize = MAXALIGN(sizeof(SlabChunk) + MAXALIGN(chunkSize));
|
fullChunkSize = MAXALIGN(sizeof(SlabChunk) + MAXALIGN(chunkSize));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user