Re: Re: Is there a memory leak in commit 8561e48? - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Re: Is there a memory leak in commit 8561e48?
Date
Msg-id 20180420033708.GA7613@paquier.xyz
Whole thread Raw
In response to Re: Is there a memory leak in commit 8561e48?  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On Fri, Apr 20, 2018 at 10:00:38AM +0800, jian.long@i-soft.com.cn wrote:
> what about just free _SPI_stack in AtEOXact_SPI? if the transaction
> end was initiated by SPI , AtEOXact_SPI will do nothing.  For example:
> @@ -283,6 +295,8 @@ AtEOXact_SPI(bool isCommit)
>                                  errmsg("transaction left non-empty SPI stack"),
>                                  errhint("Check for missing \"SPI_finish\" calls.")));
>
> +       if (_SPI_stack)
> +               pfree(_SPI_stack);

Sure, but that is rather inconsistent with the handling which exists
using TopTransactionContext where the API stack is deleted at the same
time as the transaction context, which causes this approach to be
inconsistent for atomic and non-atomic calls of SPI_connect_ext.  Let's
see what is Peter's take here first.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Should we add GUCs to allow partition pruning to be disabled?
Next
From: Thomas Munro
Date:
Subject: Re: [sqlsmith] Unpinning error in parallel worker