Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pqygK-0000Sl-FY for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Apr 2023 16:04:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pqygJ-000729-AX for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Apr 2023 16:04:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pqygJ-000720-0p for pgsql-hackers@lists.postgresql.org; Mon, 24 Apr 2023 16:04:47 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pqygG-004pBP-46 for pgsql-hackers@lists.postgresql.org; Mon, 24 Apr 2023 16:04:46 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 8B9A332005CA; Mon, 24 Apr 2023 12:04:41 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 24 Apr 2023 12:04:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1682352281; x= 1682438681; bh=UDRztfKZ3If7qLVs0h5fa349Xer3a3JU0cpmN3Y9zkY=; b=i YbnWjwrTXc5mKpIrkOJdx9KcuIwrZm0K1bJxv7EpD2Evh6xYCe549Wk2KiIfp0zU aHgyOI6vHdnHAKEiXWqde0nk1lBe1WfnCsWX1dUMR4EUhxCjodacdpVGQTrR+Rl4 7bOJoanVJ7HofWc+qi5djwa/4aisF+sU9T7TtKe9nRdE+Qi70BDeh19IgNblu2h4 WNnSKgzyb5C7q9JnIhL43whb1hsQJI+h68k7JlnX+xrHlHCASx3e6CLvUPQZFcbn sifOvjEHqhlKW0uU/pquU4D72p7dZ4g4PpitEtytIVDHJSGjYkdY7REUzlwMxR+o gc+VLoq643Q93qiQupAPg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfedutddgleeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 24 Apr 2023 12:04:39 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id D372AA1; Mon, 24 Apr 2023 18:04:19 +0200 (CEST) Date: Mon, 24 Apr 2023 18:04:19 +0200 From: Alvaro Herrera To: Tom Lane Cc: Ajit Awekar , pgsql-hackers@lists.postgresql.org, Rushabh Lathia , Jeevan Chalke Subject: Re: Memory leak in CachememoryContext Message-ID: <20230424160419.44voc3w5r72uigb6@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <193956.1682347448@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-Apr-24, Tom Lane wrote: > I wrote: > > Alvaro Herrera writes: > >> Hmm, we can leave it unused in our code, but it still needs to be > >> initialized to some valid memory context anyway; otherwise hypothetical > >> code that uses it would still crash. > > > I think we want that to happen, actually, because it's impossible > > to guess what such hypothetical code needs the context to be. > > I guess we could have the back branches continue to create a > shared_cast_context and just not use it in core. Seems rather > expensive for a very hypothetical compatibility measure, though. I think a session-long memory leak is not so bad, compared to a possible crash. However, after looking at the code again, as well as pldebugger and plpgsql_check, I agree that there's no point in doing anything other than keeping the field there. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Hay dos momentos en la vida de un hombre en los que no debería especular: cuando puede permitírselo y cuando no puede" (Mark Twain)