Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iUwLA-0006Yx-Pm for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Nov 2019 17:22:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iUwL9-0000X8-Gx for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Nov 2019 17:21:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iUwL9-0000X0-5J for pgsql-bugs@lists.postgresql.org; Wed, 13 Nov 2019 17:21:59 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iUwL2-0001SP-Nk for pgsql-bugs@lists.postgresql.org; Wed, 13 Nov 2019 17:21:57 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id xADHLlPj000369; Wed, 13 Nov 2019 12:21:47 -0500 From: Tom Lane To: Andres Freund cc: Tomas Vondra , ben@lantern.is, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16112: large, unexpected memory consumption In-reply-to: <20191113170528.caywphoaq45ggqbx@alap3.anarazel.de> References: <16112-4448bbf55a404189@postgresql.org> <20191113145004.opxx4vuajyoadbcq@development> <20191113170528.caywphoaq45ggqbx@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Wed, 13 Nov 2019 09:05:28 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <367.1573665707.1@sss.pgh.pa.us> Date: Wed, 13 Nov 2019 12:21:47 -0500 Message-ID: <368.1573665707@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On 2019-11-13 15:50:04 +0100, Tomas Vondra wrote: >> The attached trivial patch fixes that by adding a pfree() at the end of >> the function. > Hm. That's clearly an improvement. But I'm not quite sure it's really > the right direction. It seems like a bad idea to rely on > ExecMakeTableFunctionResult() otherwise never leaking any memory. Considering that ExecMakeTableFunctionResult went from zero pallocs to one, I don't see a strong reason why it should have bothered with a private memory context before, nor do I think that's a good response now. regards, tom lane