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 1h60g6-0001lg-Bb for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Mar 2019 22:24:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h60g4-0008Mm-Bv for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Mar 2019 22:24:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h60g4-0008MQ-5a for pgsql-bugs@lists.postgresql.org; Mon, 18 Mar 2019 22:24:16 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h60fz-00029p-TV for pgsql-bugs@lists.postgresql.org; Mon, 18 Mar 2019 22:24:14 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 885C33808; Mon, 18 Mar 2019 18:24:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 18 Mar 2019 18:24:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=CQOj07csSC3ckjydW4nuHcW2HhR c3WVT7KJdqr3K5zE=; b=xOglEjEmi3pjxqofcdnfnczAGBb42rMY5/KkFGJMdlT sUwUQbnAbWmYDUsOZjtYOHblZTDQIL7KQ2OdTjzyN2n3wy27I+5IJBCm8xKm5cOZ W4EsdBi4QSDREojHlow3cHYbNBBIFt8/l8tbuFdFqwQ9jgIkANNRP569g43qmwdQ lpSHXhFnMsQO0rVHHpyKUmKFRO5Lyn/lTg0DwctZ9rkWno2nYtNED3S5kNOukkbk ylQ6ucj1TtGhG9gwMwmpLHUFJ+D158lBO4fF4Ds78MX7VZA+B6w9d8iy3R9onOLW ghYOe5Ll//3+FjZ0EtYIq17ethtlajP9npLN7Q2QONg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=CQOj07 csSC3ckjydW4nuHcW2HhRc3WVT7KJdqr3K5zE=; b=iNp2jAV5MftdineSZF50B7 7eNC6VIK39/WrTlL6mvm/dNq0JDOfAok/Qcu7CcwN93iqHDE0zs3rbyQ9DeQYE2b Xv+2MB3awtCgdqmU1m2EET7tDeZ4tUikjqRXqbTLrOCc04Gzv3P7mcvdYSI2bWu8 IELlW9TiMMALXHeQFftMURCW/n80yi5d9U+xeenThFDzwB3+AypNrIzQBqMrGOAG q1OIHx16vfFz/ioUpM1Io9CLBWXRpc16hRDXx6x9BLN5D2WqE4IBIf4T0H3QezYB 0XSLmosmoNss7PPqsDLx5dnbnABZnclH9V79zFJcRIJxdvSo5X7di6hL96SeXb6g == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddriedugdduiedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucfkpheple ekrddvuddtrddugedtrddujedunecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurhgv shesrghnrghrrgiivghlrdguvgenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from intern.anarazel.de (c-98-210-140-171.hsd1.ca.comcast.net [98.210.140.171]) by mail.messagingengine.com (Postfix) with ESMTPA id 4A829E4807; Mon, 18 Mar 2019 18:24:07 -0400 (EDT) Date: Mon, 18 Mar 2019 15:24:06 -0700 From: Andres Freund To: Tom Lane Cc: Jeff Janes , Matthias Otterbach , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15700: PG 10 vs. 11: Large increase in memory usage when selecting BYTEA data (maybe memory leak) Message-ID: <20190318222406.nlc6372xfou4kr5o@alap3.anarazel.de> References: <15700-8c408321a87d56bb@postgresql.org> <16717.1552926811@sss.pgh.pa.us> <4ef5f38d5710c4d5c289537c588c7335@otterbach.eu> <13467.1552942521@sss.pgh.pa.us> <20190318215710.f6balpny456kink2@alap3.anarazel.de> <6061.1552946620@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6061.1552946620@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2019-03-18 18:03:40 -0400, Tom Lane wrote: > Andres Freund writes: > > We're also assuming that we don't leak into MessageContext over such > > cycles, which seems wrong. At the very least things like > > errdetail_params() are happy to leak into MessageContext. > > This leak isn't in MessageContext; if it were, there likely wouldn't > have been a noticeable problem. I know that this leak wasn't into MessageContext - I was (wrongly) thinking that there also might be an issue related to MessageContext too, but I was wrong on that. > It's leaking in the executor's > context over repeat ExecutorRun cycles in the same execution state. What I don't quite get is why we're doing if (sendTuples) dest->rStartup(dest, operation, queryDesc->tupDesc); inside the per-query context, given that the lifetime of the started dest receiver can be, like in this example, be considerably shorter than the query execution. I guess given the current interface we can't really do much better, as we'd also not want to leak into the calling context, and allocating yet another memory context wouldn't be cheap :( Greetings, Andres Freund