Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id E44529FB2E6 for ; Thu, 18 Jan 2007 10:46:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 50643-08-3 for ; Thu, 18 Jan 2007 10:46:23 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.228]) by postgresql.org (Postfix) with ESMTP id 6C3449FB2E9 for ; Thu, 18 Jan 2007 10:46:29 -0400 (AST) Received: by wr-out-0506.google.com with SMTP id i21so169891wra for ; Thu, 18 Jan 2007 06:46:28 -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=cb1oo/HW6/Bym8KkpdQ6lvzIzJFKIvTmqF7V+f47dvH5akOIFMnMDmnksz+bEU5tUzZzDmjuJlPAUHvC98LoRMZk0+tBpl4ar9G7m8cWmuB4Cl491s1HCLnrQ0Qwj6g0u62VBLk3o8tPRi3GYAyWdj/oVh+l8If8/KZzQEJs/WM= Received: by 10.82.162.14 with SMTP id k14mr213234bue.1169131586888; Thu, 18 Jan 2007 06:46:26 -0800 (PST) Received: by 10.82.170.1 with HTTP; Thu, 18 Jan 2007 06:46:26 -0800 (PST) Message-ID: <1d4e0c10701180646p56c18dcal2cb3526bd1050e63@mail.gmail.com> Date: Thu, 18 Jan 2007 15:46:26 +0100 From: "Guillaume Smet" To: "Dave Cramer" , "PostgreSQL JDBC" Subject: Re: Memory leaks using refcursors Cc: thierry.buffet@fr.nurun.com In-Reply-To: <1E6DB692-8D5A-493F-9E1F-82130917EE77@postgresintl.com> 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> <1d4e0c10701171527u744fd81eh6de7908599349af3@mail.gmail.com> <1d4e0c10701180057s2c2e4c85g50998c883bb470df@mail.gmail.com> <1E6DB692-8D5A-493F-9E1F-82130917EE77@postgresintl.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/116 X-Sequence-Number: 16481 Hi all, Summary of our discussion with Dave on IRC. The following patch provided by Dave fixed the problem for the first 31 iterations of our test but failed after that because the garbage collector calls the close() method a second time when the object is dereferenced (finalize() method of AbstractJDBC2Statement). So we have to be sure that when the close() method is called a second time, it doesn't fail. On 1/18/07, Dave Cramer wrote: > + > + if ( this.refCursorName != null ) > + { > + connection.execSQLUpdate("close \"" + refCursorName +'"'); I added a refCursorName = null; here to be sure the close cursor is not executed twice and it works correctly. > + } I don't have the memory leaks anymore. I'll ask the people developing the real application to test this patch to be sure everything is now OK and I'll post the confirmation here. Dave, thanks a lot for your help. -- Guillaume