Re: possible memory leak with SRFs - Mailing list pgsql-hackers

From Nikhil Sontakke
Subject Re: possible memory leak with SRFs
Date
Msg-id u2ua301bfd91005062314hf9f3e13ew4911f08a9a53bcad@mail.gmail.com
Whole thread Raw
In response to Re: possible memory leak with SRFs  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: possible memory leak with SRFs
List pgsql-hackers
Hi,

>> Can someone please explain why we do not reset the expression context
>> if an SRF is involved during execution?
>
> Consider
>        srf(foo(col))
> where foo returns a pass-by-reference datatype.  Your proposed patch
> would cut the knees out from under argument values that the SRF could
> reasonably expect to still be there on subsequent calls.
>

Yeah this is my basic confusion. But wouldn't the arguments be
evaluated afresh on the subsequent call for this SRF? In that case
freeing up the context of the *last* call should not be an issue I
would think.

And if this is indeed the case we should be using a different longer
lived context and not the ecxt_per_tuple_memory context..

Regards,
Nikhils
--
http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: including PID or backend ID in relpath of temp rels
Next
From: Simon Riggs
Date:
Subject: Re: SQLSTATE for Hot Standby cancellation