Re: BUG #1739: memory leak in pl/perl with spi_exec_query - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #1739: memory leak in pl/perl with spi_exec_query
Date
Msg-id 20421.1120427861@sss.pgh.pa.us
Whole thread Raw
In response to BUG #1739: memory leak in pl/perl with spi_exec_query  ("Jean-Max Reymond" <jmreymond@ckr-solutions.com>)
Responses Re: BUG #1739: memory leak in pl/perl with spi_exec_query
List pgsql-bugs
"Jean-Max Reymond" <jmreymond@ckr-solutions.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);

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #1739: memory leak in pl/perl with spi_exec_query
Next
From: Tzahi Fadida
Date:
Subject: a bug that might be related to BUG #1739