Re: Memory leak in incremental sort re-scan

2023-07-02 Thread Laurenz Albe
On Sun, 2023-07-02 at 20:13 +0200, Tomas Vondra wrote: > FWIW I've pushed the fix prepared by James a couple days ago. Thanks for > the report! Thanks, and sorry for being pushy. Yours, Laurenz Albe

Re: Memory leak in incremental sort re-scan

2023-07-02 Thread Tomas Vondra
On 6/29/23 13:49, Laurenz Albe wrote: > On Fri, 2023-06-16 at 00:34 +0200, Tomas Vondra wrote: >> On 6/15/23 22:36, Tom Lane wrote: >>> Tomas Vondra writes: On 6/15/23 22:11, Tom Lane wrote: > I see zero leakage in that example after applying the attached quick > hack.  (It might b

Re: Memory leak in incremental sort re-scan

2023-06-29 Thread Laurenz Albe
On Fri, 2023-06-16 at 00:34 +0200, Tomas Vondra wrote: > On 6/15/23 22:36, Tom Lane wrote: > > Tomas Vondra writes: > > > On 6/15/23 22:11, Tom Lane wrote: > > > > I see zero leakage in that example after applying the attached quick > > > > hack.  (It might be better to make the check in the calle

Re: Memory leak in incremental sort re-scan

2023-06-21 Thread James Coleman
On Thu, Jun 15, 2023 at 6:35 PM Tomas Vondra wrote: > > > > On 6/15/23 22:36, Tom Lane wrote: > > Tomas Vondra writes: > >> On 6/15/23 22:11, Tom Lane wrote: > >>> I see zero leakage in that example after applying the attached quick > >>> hack. (It might be better to make the check in the caller

Re: Memory leak in incremental sort re-scan

2023-06-15 Thread Tomas Vondra
On 6/15/23 22:36, Tom Lane wrote: > Tomas Vondra writes: >> On 6/15/23 22:11, Tom Lane wrote: >>> I see zero leakage in that example after applying the attached quick >>> hack. (It might be better to make the check in the caller, or to just >>> move the call to ExecInitIncrementalSort.) > >>

Re: Memory leak in incremental sort re-scan

2023-06-15 Thread Tom Lane
Tomas Vondra writes: > On 6/15/23 22:11, Tom Lane wrote: >> I see zero leakage in that example after applying the attached quick >> hack. (It might be better to make the check in the caller, or to just >> move the call to ExecInitIncrementalSort.) > Thanks for looking. Are you planning to work o

Re: Memory leak in incremental sort re-scan

2023-06-15 Thread Tomas Vondra
On 6/15/23 22:11, Tom Lane wrote: > Tomas Vondra writes: >> On 6/15/23 13:48, Laurenz Albe wrote: >>> ExecIncrementalSort() calls tuplesort_begin_common(), which creates the >>> "TupleSort main" >>> and "TupleSort sort" memory contexts, and ExecEndIncrementalSort() calls >>> tuplesort_end(),

Re: Memory leak in incremental sort re-scan

2023-06-15 Thread Tom Lane
Tomas Vondra writes: > On 6/15/23 13:48, Laurenz Albe wrote: >> ExecIncrementalSort() calls tuplesort_begin_common(), which creates the >> "TupleSort main" >> and "TupleSort sort" memory contexts, and ExecEndIncrementalSort() calls >> tuplesort_end(), >> which destroys them. >> But ExecReScanInc

Re: Memory leak in incremental sort re-scan

2023-06-15 Thread Tomas Vondra
Hi, On 6/15/23 13:48, Laurenz Albe wrote: > ExecIncrementalSort() calls tuplesort_begin_common(), which creates the > "TupleSort main" > and "TupleSort sort" memory contexts, and ExecEndIncrementalSort() calls > tuplesort_end(), > which destroys them. > But ExecReScanIncrementalSort() only reset

Memory leak in incremental sort re-scan

2023-06-15 Thread Laurenz Albe
ExecIncrementalSort() calls tuplesort_begin_common(), which creates the "TupleSort main" and "TupleSort sort" memory contexts, and ExecEndIncrementalSort() calls tuplesort_end(), which destroys them. But ExecReScanIncrementalSort() only resets the memory contexts. Since the next call to ExecInc