Re: Memory context can be its own parent and child in replication command
Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
From: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Paquier <michael@paquier.xyz>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-03-11T13:04:27Z
Lists: pgsql-hackers
On Tue, Mar 11, 2025 at 10:26 AM Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com> wrote: > --- a/src/backend/utils/mmgr/mcxt.c > +++ b/src/backend/utils/mmgr/mcxt.c > @@ -527,6 +527,7 @@ MemoryContextDeleteOnly(MemoryContext context) > > context->methods->delete_context(context); > > + context->type = T_Invalid; > VALGRIND_DESTROY_MEMPOOL(context); > } > > However, when testing this on my mac, it seems to trigger a heap > corruption during initdb. Which is normal since this would only work with AllocSet as other delelte_context methods would just free the context... A better spot would be just before putting the context in the freelist in AllocSetDelete.