pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jim Nasby <Jim.Nasby@BlueTreble.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Curing plpgsql's memory leaks for statement-lifespan values
Date: Thu, 18 Aug 2016 16:44:57 -0500
Message-ID: <d469bd35-35c8-f68a-540f-c542ce601a54@BlueTreble.com> (raw)
In-Reply-To: <5916.1469472648@sss.pgh.pa.us>
References: <17863.1469142152@sss.pgh.pa.us>
	<CAA4eK1JRdXqfaA25vJkVcjoi0h5YzH9Mi1brTO2DgDO6SVE26g@mail.gmail.com>
	<5811.1469375275@sss.pgh.pa.us>
	<CAA4eK1+fYBqD=+0=iEayVJ=PwQOJ+wxFHChB-AOs=d5tSDAkhw@mail.gmail.com>
	<5916.1469472648@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 7/25/16 1:50 PM, Tom Lane wrote:
> There's a glibc-dependent hack in aset.c that reports any
> plpgsql-driven palloc or pfree against a context named "SPI Proc", as
> well as changes in pl_comp.c so that transient junk created during initial
> parsing of a plpgsql function body doesn't end up in the SPI Proc context.
> (I did that just to cut the amount of noise I had to chase down.  I suppose
> in large functions it might be worth adopting such a change so that that
> junk can be released immediately after parsing; but I suspect for most
> functions it'd just be an extra context without much gain.)

Some folks do create very large plpgsql functions, so if there's a handy 
way to estimate the size of the function (pg_proc.prosrc's varlena size 
perhaps) then it might be worth doing that for quite large functions.
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)   mobile: 512-569-9461


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (20+ messages)  latest in thread

Message-ID: <d469bd35-35c8-f68a-540f-c542ce601a54@BlueTreble.com>
Permalink:  ../d469bd35-35c8-f68a-540f-c542ce601a54@BlueTreble.com/
Also on:    postgresql.org/message-id/d469bd35-35c8-f68a-540f-c542ce601a54@BlueTreble.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: Jim.Nasby@BlueTreble.com, tgl@sss.pgh.pa.us, amit.kapila16@gmail.com
  Subject: Re: Curing plpgsql's memory leaks for statement-lifespan values
  In-Reply-To: <d469bd35-35c8-f68a-540f-c542ce601a54@BlueTreble.com>
  References: <17863.1469142152@sss.pgh.pa.us> <CAA4eK1JRdXqfaA25vJkVcjoi0h5YzH9Mi1brTO2DgDO6SVE26g@mail.gmail.com> <5811.1469375275@sss.pgh.pa.us> <CAA4eK1+fYBqD=+0=iEayVJ=PwQOJ+wxFHChB-AOs=d5tSDAkhw@mail.gmail.com> <5916.1469472648@sss.pgh.pa.us> <d469bd35-35c8-f68a-540f-c542ce601a54@BlueTreble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox