Re: BUG #9223: plperlu result memory leak

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Alex Hunsaker <badalex(at)gmail(dot)com>
Cc: Sergey Burladyan <eshkinkot(at)gmail(dot)com>, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BUG #9223: plperlu result memory leak
Date: 2014-03-05 19:22:25
Message-ID: 20140305192224.GR4759@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Alex Hunsaker escribió:
> On Tue, Feb 25, 2014 at 6:56 AM, Sergey Burladyan <eshkinkot(at)gmail(dot)com> wrote:
>
> > It looks like I found the problem, Perl use reference count and something that
> > is called "Mortal" for memory management. As I understand it, mortal is free
> > after FREETMPS. Plperl call FREETMPS in plperl_call_perl_func() but after it,
> > plperl ask perl interpreter again for new mortal SV variables, for example, in
> > hek2cstr from plperl_sv_to_datum, and this new SV is newer freed.
>
> So I think hek2cstr is the only place we leak (its the only place I
> can see that allocates a mortal sv without being wrapped in
> ENTER/SAVETMPS/FREETMPS/LEAVE).
>
> Does the attached fix it for you?

Can I bug you into verifying what supported releases need this patch,
and to which does it backpatch cleanly? And if there's any to which it
doesn't, can I further bug you into providing one that does?

Thanks,

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alex Hunsaker 2014-03-05 19:55:14 Re: [BUGS] BUG #9223: plperlu result memory leak
Previous Message Alvaro Herrera 2014-03-05 18:39:11 Re: BUG #9447: still bug in autovacuum after upgrading to 9.1.11?

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-03-05 19:22:30 Re: Custom Scan APIs (Re: Custom Plan node)
Previous Message Sawada Masahiko 2014-03-05 19:15:00 Re: The behavior of CheckRequiredParameterValues()