Re: tuplesort Generation memory contexts don't play nicely with index builds - Mailing list pgsql-hackers

From David Rowley
Subject Re: tuplesort Generation memory contexts don't play nicely with index builds
Date
Msg-id CAApHDvrNXuE3egg3pVCsepNj_Y8eBhwFdFwxc=H=xc-aG7jSXg@mail.gmail.com
Whole thread Raw
In response to tuplesort Generation memory contexts don't play nicely with index builds  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: tuplesort Generation memory contexts don't play nicely with index builds
Re: tuplesort Generation memory contexts don't play nicely with index builds
List pgsql-hackers
On Wed, 29 Jun 2022 at 12:59, David Rowley <dgrowleyml@gmail.com> wrote:
> I noticed while doing some memory context related work that since we
> now use generation.c memory contexts for tuplesorts (40af10b57) that
> tuplesort_putindextuplevalues() causes memory "leaks" in the
> generation context due to index_form_tuple() being called while we're
> switched into the state->tuplecontext.

I voiced my dislike for the patch I came up with to fix this issue to
Andres.  He suggested that I just add a version of index_form_tuple
that can be given a MemoryContext pointer to allocate the returned
tuple into.

I like that idea much better, so I've attached a patch to fix it that way.

If there are no objections, I plan to push this in the next 24 hours.

David

Attachment

pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Issue with pg_stat_subscription_stats
Next
From: Andres Freund
Date:
Subject: Re: Issue with pg_stat_subscription_stats