Re: strong memory leak in plpgsql from handled rollback and lazy cast

2019-10-16 Thread Andres Freund
Hi, On 2019-09-22 20:16:15 -0400, Tom Lane wrote: > I think you're considering a much smaller slice of the system than > what seems to me to be at risk here. As an example, an ExprState > tree would also include any fn_extra-linked state that individual > functions might've set up. > > Hm. I int

Re: strong memory leak in plpgsql from handled rollback and lazy cast

2019-09-22 Thread Andres Freund
Hi, On 2019-09-22 20:16:15 -0400, Tom Lane wrote: > Andres Freund writes: > > On 2019-09-22 18:43:23 -0400, Tom Lane wrote: > >> I'm not convinced that it'd be safe to re-use an ExprState after a > >> previous execution failed (though perhaps Andres has a different > >> opinion?) > > > I don't i

Re: strong memory leak in plpgsql from handled rollback and lazy cast

2019-09-22 Thread Tom Lane
Andres Freund writes: > On 2019-09-22 18:43:23 -0400, Tom Lane wrote: >> I'm not convinced that it'd be safe to re-use an ExprState after a >> previous execution failed (though perhaps Andres has a different >> opinion?) > I don't immediately see why it'd be problematic to reuse at a later > time

Re: strong memory leak in plpgsql from handled rollback and lazy cast

2019-09-22 Thread Andres Freund
Hi, On 2019-09-22 18:43:23 -0400, Tom Lane wrote: > I'm not convinced that it'd be safe to re-use an ExprState after a > previous execution failed (though perhaps Andres has a different > opinion?) I don't immediately see why it'd be problematic to reuse at a later time, as long as it's guarantee

Re: strong memory leak in plpgsql from handled rollback and lazy cast

2019-09-22 Thread Tom Lane
Pavel Stehule writes: > When I tested some hypothesis I wrote buggy code. It was surprise how fast > I lost all free memory > do $$ > begin > for i in 1..300 > loop > begin > -- do some error > if i then end if; > exception when others then > -- do nothing >

strong memory leak in plpgsql from handled rollback and lazy cast

2019-09-17 Thread Pavel Stehule
Hi When I tested some hypothesis I wrote buggy code. It was surprise how fast I lost all free memory do $$ begin for i in 1..300 loop begin -- do some error if i then end if; exception when others then -- do nothing end; end loop; end; $$; problem is somew