Re: Curing plpgsql's memory leaks for statement-lifespan values

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Curing plpgsql's memory leaks for statement-lifespan values
Date: 2016-08-19 17:29:09
Message-ID: d7f3cc7b-ca8f-f9ab-edd9-a93195c6ce2a@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 8/19/16 10:42 AM, Tom Lane wrote:
> It appeared to me after collecting some stats about the functions present
> in the regression tests that for larger functions, the extra space eaten
> is just some small multiple (like 2x-3x) of the function body string
> length. So it's not *that* much data, even for big functions, and it's
> only going to be eaten on the first usage of a function within a session.

I wonder if freeing that memory would help speed up further allocations,
and how much of the expense of the final free for the context gets
reduced by an early reset. Probably not enough to negate the cost of
resetting on every call though...
--
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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2016-08-19 17:31:14 Re: Exporting more function in libpq
Previous Message Corey Huinker 2016-08-19 16:37:35 Re: anyelement -> anyrange