Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZHAFu-0005FF-0d for pgsql-bugs@arkaria.postgresql.org; Mon, 20 Jul 2015 12:33:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZHAFt-0007Ar-I4 for pgsql-bugs@arkaria.postgresql.org; Mon, 20 Jul 2015 12:33:13 +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.84) (envelope-from ) id 1ZHACS-0005Z3-T2 for pgsql-bugs@postgresql.org; Mon, 20 Jul 2015 12:29:41 +0000 Received: from smtp-auth.no-ip.com ([8.23.224.61] helo=out.smtp-auth.no-ip.com) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZHACO-0004ry-Ve for pgsql-bugs@postgresql.org; Mon, 20 Jul 2015 12:29:39 +0000 X-No-IP: alvh.no-ip.org@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from alvin.alvh.no-ip.org (unknown [89.176.99.192]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id 650C94009DF; Mon, 20 Jul 2015 05:29:30 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 80466361C; Mon, 20 Jul 2015 16:29:28 +0400 (SAMT) Date: Mon, 20 Jul 2015 14:29:28 +0200 From: Alvaro Herrera To: Michael Paquier Cc: Tom Lane , Bill Parker , PostgreSQL mailing lists Subject: Re: Lack of Sanity Checking in file 'pctcl.c' for PostgreSQL 9.4.x Message-ID: <20150720122928.GM2301@postgresql.org> References: <20150612194716.GQ133018@postgresql.org> <4457.1434166911@sss.pgh.pa.us> <20150718155421.GZ2301@postgresql.org> <20150718201915.GA2297@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Michael Paquier wrote: > > With some additional effort, we could get rid of perm_fmgr_info, at > > least in pltcl. (That hack was introduced in a3ed622b63b and > > 7748e9e7e5a back in 2001 and we never actually fixed it ...) > > Yes it seems so, even for plperl and plpython there seem to be some > room for improvement at quick glance... This looks like a master-only > change to me though (and I am sure we are on the same page). For > back-branches something like the previous patch is definitely safer. Pushed. All in all, the whole business of memory allocation in pltcl is pretty nasty. If people is really interested in pltcl, that should probably be fixed to avoid memory leaks. For one thing, the query cache hash is global to the interpreter, not local to the function; whenever a function is recompiled, the old SPI_prepared plans linger forever in the interpreter (for the life of the session). It would be nicer if those were tied to the function lifetime. For this, the hashtable would have to be moved to the query desc struct. pltcl_spi_prepare would have to know the currently executing function desc struct ... Maybe Bill is interested enough to write a patch? -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs