Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id A6D0A9FA217 for ; Wed, 17 Jan 2007 19:28:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 16301-02 for ; Wed, 17 Jan 2007 19:27:54 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) by postgresql.org (Postfix) with ESMTP id 8BA3C9FA176 for ; Wed, 17 Jan 2007 19:27:58 -0400 (AST) Received: by ug-out-1314.google.com with SMTP id k3so18885ugf for ; Wed, 17 Jan 2007 15:27:57 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=cRQ7YAjQEFGSz7fwWv6nOzUJ7LEP5IHcdl+JV87YlilfcI6WrIKLKzWN2K9EqmK0m9tPnx4gN38tbuJCp0vurcOGz0sW+9RKyY9CfHDqa0960zXKr3O5oFOSvWtEYoLs+R6BPjsBA8VLTMaflIGy1ju9CErAvcn6GR+7T9yhIjw= Received: by 10.82.152.16 with SMTP id z16mr38140bud.1169076473968; Wed, 17 Jan 2007 15:27:53 -0800 (PST) Received: by 10.82.170.1 with HTTP; Wed, 17 Jan 2007 15:27:53 -0800 (PST) Message-ID: <1d4e0c10701171527u744fd81eh6de7908599349af3@mail.gmail.com> Date: Thu, 18 Jan 2007 00:27:53 +0100 From: "Guillaume Smet" To: "Tom Lane" Subject: Re: Memory leaks using refcursors Cc: "PostgreSQL JDBC" , thierry.buffet@fr.nurun.com In-Reply-To: <6135.1169073075@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1d4e0c10701171053t55e60a2epf3e395b5b97101b5@mail.gmail.com> <1d4e0c10701171422u2e9d8758ia663dd1f826f8258@mail.gmail.com> <6135.1169073075@sss.pgh.pa.us> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/113 X-Sequence-Number: 16478 Hi Tom, On 1/17/07, Tom Lane wrote: > While I agree that the driver probably should do that, I'm not sure why > you are having a problem. A cursor doesn't normally accumulate its > result set in memory on the backend side, so I wouldn't have expected > all that big a memory leak. What queries are you executing? I don't know exactly how much queries are executed during this transaction but it's a lot of queries and they are _all_ executed through stored proc returning cursors. The self contained test case is available here: http://people.openwide.fr/~gsmet/postgresql/refcursor_problem/ and especially the stored proc is in the readme file along with all the instructions to run the test case. I just run a test case with 10k iterations and the backend which executes the queries uses 236 MB of memory before the commit. -- Guillaume