Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fzk37-0003ba-52 for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Sep 2018 14:53:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fzk35-00017h-H0 for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Sep 2018 14:53:51 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fzk35-00017W-7x for pgsql-bugs@lists.postgresql.org; Tue, 11 Sep 2018 14:53:51 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fzk32-0006aU-2y for pgsql-bugs@lists.postgresql.org; Tue, 11 Sep 2018 14:53:50 +0000 Received: from [192.168.127.1] (port=47749 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1fzk2z-0009x0-Ro; Tue, 11 Sep 2018 14:53:45 +0000 Received: from [127.0.0.1] (port=42194 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1fzk2y-000AYi-N2; Tue, 11 Sep 2018 14:53:44 +0000 From: Andrew Gierth To: Alexander Korotkov Cc: pgsql-bugs@lists.postgresql.org, Teodor Sigaev Subject: Re: BUG #15378: SP-GIST memory context screwup? In-Reply-To: (Alexander Korotkov's message of "Tue, 11 Sep 2018 17:39:36 +0300") Message-ID: <8736ugqekv.fsf@news-spur.riddles.org.uk> References: <153663176628.23136.11901365223750051490@wrigleys.postgresql.org> <87bm94rba5.fsf@news-spur.riddles.org.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Tue, 11 Sep 2018 15:53:43 +0100 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "Alexander" == Alexander Korotkov writes: >> So this logic was added in ccd6eb49a and was wrong from the start. >> Testing suggests that removing the offending pfree does indeed fix >> the issue; any objections? Alexander> No objections from me. What about moving Alexander> MemoryContextReset(so->traversalCxt) into Alexander> resetSpGistScanOpaque()? For me it seems that resetting of Alexander> traversal memory context is part of opaque reset. Looking at all those retail pfrees makes me itch... is there some reason why reconstructedValue couldn't go in the traversal context too, and then the list nodes could go there as well, and the whole thing freed with a context reset? -- Andrew (irc:RhodiumToad)