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 1fzktG-00065D-BZ for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Sep 2018 15:47:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fzktE-0003HA-Lu for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Sep 2018 15:47:44 +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 1fzktE-0003Gf-CF for pgsql-bugs@lists.postgresql.org; Tue, 11 Sep 2018 15:47:44 +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 1fzktB-0000P8-R9 for pgsql-bugs@lists.postgresql.org; Tue, 11 Sep 2018 15:47:43 +0000 Received: from [192.168.127.1] (port=30961 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 1fzkt7-000A1V-W9; Tue, 11 Sep 2018 15:47:38 +0000 Received: from [127.0.0.1] (port=33446 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1fzkt7-000Atu-Au; Tue, 11 Sep 2018 15:47:37 +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: <87y3c8oy1g.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 16:47:37 +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. But it turns out that removing the pfree will cause transient leakage within the scan, since ScanStackEntry objects are also freed retail during a walk. ugh. So the simplest fix would be to move the memory context reset to just after the freeScanStack in resetSpGistScanOpaque. And with retail freeing going on during the scan, it makes less sense to try and avoid it during rescan, double ugh. -- Andrew (irc:RhodiumToad)