Re: BUG #9223: plperlu result memory leak

From: Alex Hunsaker <badalex(at)gmail(dot)com>
To: Sergey Burladyan <eshkinkot(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-25 20:46:30
Message-ID: CAFaPBrSpM+uhbe4J1ayQMAqj_Q0rvup=j0Y76WsSdfxpy_E7xw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

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?

Attachment Content-Type Size
plperl_hek2cstr_leak.patch text/x-patch 923 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2014-02-25 21:49:04 Re: BUG #9342: CPU / Memory Run-away
Previous Message john.k.hord 2014-02-25 19:38:09 BUG #9349: plpgsql.so: undefined symbol: CheckFunctionValidatorAccess

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2014-02-25 21:00:04 Re: Ctrl+C from sh can shut down daemonized PostgreSQL cluster
Previous Message Alvaro Herrera 2014-02-25 20:45:03 Re: Dump pageinspect to 1.2: page_header with pg_lsn datatype