Re: BUG #9223: plperlu result memory leak

From: Sergey Burladyan <eshkinkot(at)gmail(dot)com>
To: Alex Hunsaker <badalex(at)gmail(dot)com>
Cc: 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-02-26 08:58:57
Message-ID: 87lhwymer2.fsf@seb.koffice.internal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Alex Hunsaker <badalex(at)gmail(dot)com> writes:

> 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).

Yeah, I also try to fix only hek2cstr, but failed.

> Does the attached fix it for you?

Yes, your patch is fix it for me, thank you, Alex!

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Cyriac Joseph Maliyil 2014-02-26 13:11:44 Re: BUG #9333: The PostgreSQL service stops unexpectedly
Previous Message Rainer Tammer 2014-02-26 08:41:48 Re: Problem with PostgreSQL 9.2.7 and make check on AIX 7.1

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-02-26 09:04:36 Re: Unfortunate choice of short switch name in pgbench
Previous Message Christian Kruse 2014-02-26 08:35:30 Re: [PATCH] Use MAP_HUGETLB where supported (v3)