Thread: where are the memory leaks?

where are the memory leaks?

From
Markus Wagner
Date:
Hi,

we have an application that should insert about 1 Million records into a
table. For each record there are some complex SELECT-statements that look for
"similar" records, and one INSERT-statement. The whole handling for one
record is encapsulated within "BEGIN" and "END".

The thing is that the process is "killed" after about 12000 records.

The postgres log file says something like "out of memory".

First, we thought of some memory-related programming mistakes in our code. We
checked that with a counter that is modified by allocation and deallocation
functions. So we can be sure for 90 % that there is no mistake.

We also made sure that each PGResult pointer is cleared when it is not used
anymore. But still the program is killed.

Now we are wondering if there are other things in the pg library (libpq) that
need to be freed, e. g. what about the return value of PQgetvalue?

What else could we do to find the memory leaks?

Thank you,

Markus

Re: where are the memory leaks?

From
Tom Lane
Date:
Markus Wagner <wagner@imsd.uni-mainz.de> writes:
> The postgres log file says something like "out of memory".

An accurate reproduction of the exact error message you are getting might
help us help you.

Also, what do you mean by "postgres log file" --- if that's the
postmaster log, I would not expect it to report problems occurring
inside client programs.  Are you sure it's the client process running
out of memory, and not the backend?

Which PG version is this?

            regards, tom lane