pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: eshkinkot@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #9223: plperlu result memory leak
Date: Fri, 14 Feb 2014 16:31:25 +0000
Message-ID: <20140214163125.24620.66179@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      9223
Logged by:          Sergey Burladyan
Email address:      eshkinkot@gmail.com
PostgreSQL version: 9.2.6
Operating system:   Debian testing
Description:        

PostgreSQL 9.2.6 on x86_64-unknown-linux-gnu, compiled by gcc (Debian
4.8.2-10) 4.8.2, 64-bit

This is perl 5, version 18, subversion 2 (v5.18.2) built for
x86_64-linux-gnu-thread-multi

create function perl_test(IN data text, OUT v1 text, OUT v2 integer, OUT v3
integer, OUT v4 json, OUT v5 json)
  returns record as
$BODY$

use strict;
use warnings;

my $res->{'v1'} = 'content';

return $res;

$BODY$
  language plperlu volatile strict;

test case:
select count(perl_test('')) from generate_series(1, 1000000);

before:
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
sergey   14771  0.0  0.0 1127204 6916 ?        Ss   20:16   0:00 postgres:
sergey sergey 127.0.0.1(60492) idle                               

after first run:
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
sergey   14771 20.5  1.0 1216824 88308 ?       Ss   20:16   0:08 postgres:
sergey sergey 127.0.0.1(60492) idle                               

after second run:
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
sergey   14771  9.1  2.8 1360876 229488 ?      Ss   20:16   0:16 postgres:
sergey sergey 127.0.0.1(60492) idle                               


similar plpgsql function does not create a memory leak:

create function plpgsql_test(IN data text, OUT v1 text, OUT v2 integer, OUT
v3 integer, OUT v4 json, OUT v5 json)
  returns record as
$BODY$
begin

  v1 := 'content';

end
$BODY$
  language plpgsql volatile strict;

select count(plpgsql_test('')) from generate_series(1, 1000000);

first run, before:
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
sergey   14836  0.0  0.0 1126448 4064 ?        Ss   20:21   0:00 postgres:
sergey sergey 127.0.0.1(60577) idle                               

after first run:
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
sergey   14836  5.4  0.0 1128924 5636 ?        Ss   20:21   0:05 postgres:
sergey sergey 127.0.0.1(60577) idle                               

after second run:
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
sergey   14836  7.8  0.1 1131292 8108 ?        Ss   20:21   0:10 postgres:
sergey sergey 127.0.0.1(60577) idle                               

after third run:
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
sergey   14836  9.1  0.1 1131292 8108 ?        Ss   20:21   0:15 postgres:
sergey sergey 127.0.0.1(60577) idle                               



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (9+ messages)  latest in thread

Message-ID: <20140214163125.24620.66179@wrigleys.postgresql.org>
Permalink:  ../20140214163125.24620.66179@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20140214163125.24620.66179@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: eshkinkot@gmail.com
  Subject: Re: BUG #9223: plperlu result memory leak
  In-Reply-To: <20140214163125.24620.66179@wrigleys.postgresql.org>
  References: <20140214163125.24620.66179@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox