Skip to content

Commit 94884e1

Browse files
committed
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
1 parent 3ec76ff commit 94884e1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/utils/mmgr/slab.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ SlabContextCreate(MemoryContext parent,
194194
MAXALIGN(sizeof(SlabChunk)),
195195
"padding calculation in SlabChunk is wrong");
196196

197-
/* otherwise the linked list inside freed chunk isn't guaranteed to fit */
198-
StaticAssertStmt(MAXIMUM_ALIGNOF >= sizeof(int),
199-
"MAXALIGN too small to fit int32");
197+
/* Make sure the linked list node fits inside a freed chunk */
198+
if (chunkSize < sizeof(int))
199+
chunkSize = sizeof(int);
200200

201201
/* chunk, including SLAB header (both addresses nicely aligned) */
202202
fullChunkSize = MAXALIGN(sizeof(SlabChunk) + MAXALIGN(chunkSize));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy