Re: BUG #4677: memory growth - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #4677: memory growth
Date
Msg-id 6168.1235681416@sss.pgh.pa.us
Whole thread Raw
In response to BUG #4677: memory growth  ("aiwaniuk" <aiwaniuk@instytut.com.pl>)
Responses Re: BUG #4677: memory growth  (aiwaniuk@instytut.com.pl)
Re: BUG #4677: memory growth  (aiwaniuk@instytut.com.pl)
List pgsql-bugs
"aiwaniuk" <aiwaniuk@instytut.com.pl> writes:
> i postgres version 8.2, 8.3 and probobly 8.1 there is problem with running
> VOLATILE  plpgsql function with begin - exception checking that performs
> other VOLATILE  plpgsql function. if either, first or second performing
> removed, problem doesn't shows. here's an example

The reason there's an issue here is that you're invoking the same
function f() both inside and outside the subtransactions caused by
the begin/exception block.  The expressions inside f() get re-prepared
each time the subtransaction ID changes.  The memory this eats is
reclaimed at subtransaction end.  So the memory used by the call inside
the begin/exception block is cleaned up immediately, but the memory
used by the other call accumulates in the outer subtransaction's
workspace.

We'll think about how to fix this, but you shouldn't expect that a
fix will appear quickly.  A possible workaround is to put another
begin/exception block around the other call of the function.

            regards, tom lane

pgsql-bugs by date:

Previous
From: "aiwaniuk"
Date:
Subject: BUG #4677: memory growth
Next
From: Manuel G Vazquez B/Mexico/IBM
Date:
Subject: Support platform of PostgresSQL 8.1.9 under IBM AIX 5.3