Re: BUG #1739: memory leak in pl/perl with spi_exec_query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jean-Max Reymond" <jmreymond(at)ckr-solutions(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1739: memory leak in pl/perl with spi_exec_query
Date: 2005-07-03 21:57:41
Message-ID: 20421.1120427861@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Jean-Max Reymond" <jmreymond(at)ckr-solutions(dot)com> writes:
> So, spi_exec_query allocates memory but this memory is never released until
> the end of the stored procedure.

Ah, found it.

regards, tom lane

Index: plperl.c
===================================================================
RCS file: /cvsroot/pgsql/src/pl/plperl/plperl.c,v
retrieving revision 1.67.4.1
diff -c -r1.67.4.1 plperl.c
*** plperl.c 23 May 2005 02:02:52 -0000 1.67.4.1
--- plperl.c 3 Jul 2005 21:55:03 -0000
***************
*** 1419,1424 ****
--- 1419,1426 ----
Int32GetDatum(tupdesc->attrs[i]->atttypmod)));

hv_store(hv, attname, namelen, newSVpv(outputstr, 0), 0);
+
+ pfree(outputstr);
}

return newRV_noinc((SV *) hv);

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2005-07-03 22:53:41 Re: a bug that might be related to BUG #1739
Previous Message Tom Lane 2005-07-03 21:28:00 Re: BUG #1739: memory leak in pl/perl with spi_exec_query