Are you doing a "pg_result -clear" to release each pg_exec resultwhen you are done with it? If not, you'll eventually run out ofmemory...
regards, tom lane