Re: Unexpected memory usage for repeated inserts within plpgsql function

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: happy times <guangzhouzhang(at)qq(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, 德哥 <digoal(at)126(dot)com>
Subject: Re: Unexpected memory usage for repeated inserts within plpgsql function
Date: 2016-07-21 13:49:15
Message-ID: CAFiTN-tsr=pGsyDmZEXJdWw8RKncua6OFzhkwKbsEv2AcwwecA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 21, 2016 at 4:09 PM, happy times <guangzhouzhang(at)qq(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-07-21 13:49:33 Re: PoC: Make it possible to disallow WHERE-less UPDATE and DELETE
Previous Message Michael Paquier 2016-07-21 13:32:08 Re: [BUG] pg_basebackup from disconnected standby fails