Tomas Vondra <tomas.von...@enterprisedb.com> writes: > On 8/30/22 02:45, David Rowley wrote: >> I think the existing sentinel check looks wrong: >> if (!sentinel_ok(chunk, slab->chunkSize)) >> shouldn't that be passing the pointer rather than the chunk?
> I agree the check in SlabCheck() looks wrong, as it's ignoring the chunk > header (unlike the other contexts). > But yeah, I ran "make check-world" and it passed just fine, so my only > explanation is that the check never actually executes because there's no > space for the sentinel thanks to alignment, and the tweak you did breaks > that. Strange ... A quick code-coverage check confirms that the sentinel_ok() line is not reached in core or test_decoding tests as of HEAD (on a 64-bit machine anyway). So we just happen to be using only allocation requests that are already maxaligned. I wonder if slab ought to artificially bump up such requests when MEMORY_CONTEXT_CHECKING is enabled, so there's room for a sentinel. I think it's okay for aset.c to not do that, because its power-of-2 behavior means there usually is room for a sentinel; but slab's policy makes it much more likely that there won't be. regards, tom lane