On Tue, Mar 11, 2025 at 10:26 AM Anthonin Bonnefoy
<anthonin(dot)bonnefoy(at)datadoghq(dot)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.