Re: Memory context can be its own parent and child in replication command

From: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Memory context can be its own parent and child in replication command
Date: 2025-03-11 13:04:27
Message-ID: CAO6_XqrSYJdmp9EOpj1RztEEpdwgtAiXK5m+OCg0LMY0JK1Njg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2025-03-11 13:06:05 Re: bogus error message for ALTER TABLE ALTER CONSTRAINT
Previous Message Amit Kapila 2025-03-11 13:00:42 Re: Parallel heap vacuum