Re: pgsql: Move memory management away from writetup() and tuplesort_put*()

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Alexander Korotkov <akorotkov(at)postgresql(dot)org>, pgsql-committers <pgsql-committers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Move memory management away from writetup() and tuplesort_put*()
Date: 2022-08-27 11:54:28
Message-ID: CAPpHfdsF=XyG=_-=WYoFLfkLd332mq8CNLNs9xu6PHgJCvVshg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Hi, David!

On Fri, Aug 26, 2022 at 3:53 AM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>
> On Wed, 27 Jul 2022 at 17:29, Alexander Korotkov
> <akorotkov(at)postgresql(dot)org> wrote:
> > src/backend/utils/sort/tuplesort.c | 78 ++++++++++++++++----------------------
>
> I was wondering about the following comment that this commit added:
>
> +/*
> + * Write a stored tuple onto tape.tuple. Unless the slab allocator is
> + * used, after writing the tuple, pfree() the out-of-line data (not the
> + * SortTuple struct!), and increase state->availMem by the amount of
> + * memory space thereby released.
> + */
> static void
> writetuple(Tuplesortstate *state, LogicalTape *tape, SortTuple *stup)
>
> LogicalTable has no field named 'tuple' so I'm thinking the
> "tape.tuple" is a mistake?

Thank you for catching this. Yes, it definitely should be just
"tape", not "tape.tuple".

> If so, maybe the comment should be:
>
> /*
> * Write 'stup' out onto 'tape' and, unless using the slab allocator,
> pfree stup's
> * tuple and adjust the memory accounting accordingly.
> */

I've just pushed a fix for this. But I didn't change the comment to
refer veritable names, just fixed the typo.

------
Regards,
Alexander Korotkov

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-08-27 14:15:17 Re: pgsql: Remove unnecessary casts in free() and pfree()
Previous Message Alexander Korotkov 2022-08-27 11:52:05 pgsql: Fix typo in comment for writetuple() function