From: Marc Cousin <mcousin@sigma.fr>
To: pgsql-admin@postgresql.org
Subject: Re: plpgsql function seems to be leaking memory
Date: Tue, 24 Jun 2008 17:29:09 +0200
Message-ID: <200806241729.09998.mcousin@sigma.fr> (raw)
In-Reply-To: <16759.1214319370@sss.pgh.pa.us>
References: <200806241056.29589.mcousin@sigma.fr>
<16759.1214319370@sss.pgh.pa.us>
On Tuesday 24 June 2008 16:56:10 Tom Lane wrote:
> Marc Cousin <mcousin@sigma.fr> writes:
> > I'm having a problem with plpgsql functions leaking memory.
>
> Your example shows absolutely no memory leak here, in either 8.3.3
> or CVS HEAD.
>
> > I see the postgresql process growing from 8MB to about 400 MB during this
> > run...
>
> What do you have shared_buffers set to? I think you might be getting
> fooled by top's treatment of shared memory (ie, it starts to count
> shared pages after the process touches them for the first time).
>
> regards, tom lane
I'm seeing this with ps aux, you're (almost) right... And I've been wasting your time.
At the begining :
postgres 23305 39.2 0.8 1275484 31208 ? Rs 17:07 0:18 postgres: postgres test [local] idle in transaction
Then after a few seconds :
postgres 23305 39.2 0.8 1275484 31208 ? Rs 17:07 0:18 postgres: postgres test [local] idle in transaction
The RSS column is growing ... Here it is only a test, but I've been having
it get to more that 500MB on the real use case, and it got me worried...
shared_buffers is at 1GB...
So in fact, the problem is linked to RSS containing some shared memory...
And that this growing memory is because the process has put all those
modified blocks in the shared buffers... I've confirmed that with doing the
inserts out of plpgsql, and it's also the same if I select the process...
And I never noticed it before ...
It all started with a plperl procedure and I was afraid I had a leak in it ... :)
Sorry to have wasted your time and thanks a lot ...
Regards.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: mcousin@sigma.fr
Subject: Re: plpgsql function seems to be leaking memory
In-Reply-To: <200806241729.09998.mcousin@sigma.fr>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox