Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oSgrJ-0005Bt-AV for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Aug 2022 15:39:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oSgrI-0001fl-3i for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Aug 2022 15:39:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oSgrH-0001fb-Qr for pgsql-hackers@lists.postgresql.org; Mon, 29 Aug 2022 15:39:27 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oSgrF-0005no-PP for pgsql-hackers@lists.postgresql.org; Mon, 29 Aug 2022 15:39:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 27TFdLVK3209101; Mon, 29 Aug 2022 11:39:21 -0400 From: Tom Lane To: David Rowley cc: Tomas Vondra , Amit Kapila , Andres Freund , Robert Haas , Yura Sokolov , PostgreSQL Developers Subject: Re: Reducing the chunk header sizes on all memory context types In-reply-to: <3207033.1661786757@sss.pgh.pa.us> References: <20220809184410.g6yzu6pvttuphag5@awork3.anarazel.de> <3137572.1661780863@sss.pgh.pa.us> <3205803.1661786437@sss.pgh.pa.us> <3207033.1661786757@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Mon, 29 Aug 2022 11:25:57 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3209099.1661787561.1@sss.pgh.pa.us> Date: Mon, 29 Aug 2022 11:39:21 -0400 Message-ID: <3209100.1661787561@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Got it: sizeof(SlabBlock) isn't a multiple of MAXALIGN, (gdb) p sizeof(SlabBlock) $4 = 20 but this coding requires it to be: #define SlabBlockGetChunk(slab, block, idx) \ ((MemoryChunk *) ((char *) (block) + sizeof(SlabBlock) \ + (idx * slab->fullChunkSize))) So what you actually need to do is add some alignment padding to SlabBlock. I'd suggest reverting df0f4feef as it seems to be a red herring. regards, tom lane