Re: Unexpected memory usage for repeated inserts within plpgsql function - Mailing list pgsql-hackers

From Dilip Kumar
Subject Re: Unexpected memory usage for repeated inserts within plpgsql function
Date
Msg-id CAFiTN-tsr=pGsyDmZEXJdWw8RKncua6OFzhkwKbsEv2AcwwecA@mail.gmail.com
Whole thread Raw
In response to Unexpected memory usage for repeated inserts within plpgsql function  ("happy times" <guangzhouzhang@qq.com>)
Responses Re: Unexpected memory usage for repeated inserts within plpgsql function  (Guangzhou Zhang <35514815@qq.com>)
List pgsql-hackers

On Thu, Jul 21, 2016 at 4:09 PM, happy times <guangzhouzhang@qq.com> wrote:
My question: Is this problem as-designed?

Actually problem is in exec_stmt_dynexecute function, We make a copy of the query string,
and before we free it, it thow an error from SPI_execute (because table does not exist)
And this is happening in infinite loop, so we are seeing memory leak.

exec_stmt_dynexecute
{
....

/* copy it out of the temporary context before we clean up */

querystr = pstrdup(querystr);

}


--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [BUG] pg_basebackup from disconnected standby fails
Next
From: Tom Lane
Date:
Subject: Re: PoC: Make it possible to disallow WHERE-less UPDATE and DELETE