Sven Willenberger <sven@dmv.com> writes:
> Any suggestions on how to trace what is going on? Debug output methods?
The first thing to figure out is whether the leak is inside Perl or in
Postgres proper. If I were trying to do this I'd run the function a
couple times, then attach to the (idle) backend with gdb and do
call MemoryContextStats(TopMemoryContext)
to dump a summary of Postgres' memory usage to stderr. If that doesn't
show any remarkable bloat then the problem is inside Perl (and beyond my
ability to do much with).
One thing I'm still a bit baffled about is why my test didn't show a
problem; it sure looks identical to yours. Maybe the issue is Perl
version specific? I tested using the current FC3 version, which is
perl-5.8.5-9.
regards, tom lane