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

From aiwaniuk@instytut.com.pl
Subject Re: BUG #4677: memory growth
Date
Msg-id 20090227110018.GA13356@troy.imm
Whole thread Raw
In response to Re: BUG #4677: memory growth  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Thu, Feb 26, 2009 at 03:50:16PM -0500, Tom Lane wrote:
> "aiwaniuk" <aiwaniuk@instytut.com.pl> writes:
> > i postgres version 8.2, 8.3 and probobly 8.1 there is problem with running
> 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.

thanks for replay.

i have to say something more. i see that if there is one perform
of f() (no matter if it is begin - exception block, or not) postgres
process consumes 450MB of memory. but if there are two executions of
f(), and i make
select info.memory_growth(1000000);
postgres process consumes 5.2GB of memory. this is way too much...
or not ? isn't it some bug in memory reciment ?

executing f() only once, consumes as i mention, 450MB of
memory. changing number of loops in execution do not lead to memory
growth. if we performing two executions of f() (one in begin -
exception block) used memory is growing, on and on. i have 13GB of
memory, and multiplying number loops by 10 (from 1000000 to 10000000)
causes server crash - not enough memory.

there is  one interesting thing, if i create a copy of f() function (lets say
f1), and function f() is performing in begin-exception block, and f1()
is performing in main block, mamory do not grows!! postgres constantly
uses 450MB interesting, isn't it ?

looking forward for comment

pgsql-bugs by date:

Previous
From: Dave Page
Date:
Subject: Re: BUG #4635: postgres.exe crash when RAISE NOTICE during debugging of PL/pgSQL function in PgAdminIII
Next
From: aiwaniuk@instytut.com.pl
Date:
Subject: Re: BUG #4677: memory growth