On Tuesday 24 June 2008 16:56:10 Tom Lane wrote: > Marc Cousin <mcousin@xxxxxxxx> 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.