Re: plperl and inline functions -- first draft

From: Alexey Klyukin <alexk(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>, Joshua Tolley <eggyknap(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: plperl and inline functions -- first draft
Date: 2009-11-29 09:04:39
Message-ID: AAA71B8A-8900-478E-9CFF-72E32C9A32A4@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Nov 29, 2009, at 4:40 AM, Tom Lane wrote:

> Alexey Klyukin <alexk(at)commandprompt(dot)com> writes:
>
>> Isn't it also the case with the existing plperl code ? I've noticed that free(prodesc) is called when it's no longer used (i.e. in plperl_compile_callback:1636), but refcount of desc->reference is never decremented.
>
> I've been experimenting with this and confirmed that there is a leak;
> not only in the DO patch but in the pre-existing code, if a plperl
> function is redefined repeatedly.
>
> Is this the correct way to release the SV* reference?
>
> if (reference)
> SvREFCNT_dec(reference);

Yes. In fact this only decreases the reference count, making the interpreter free the memory referred to when it becomes 0, but since prodesc->reference has refcount of 1 this would do the right thing.

--
Alexey Klyukin http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2009-11-29 09:31:41 Re: Timezones (in 8.5?)
Previous Message Hitoshi Harada 2009-11-29 08:46:51 Re: add more frame types in window functions (ROWS)