Re: Memory leaks using refcursors - Mailing list pgsql-jdbc

From Guillaume Smet
Subject Re: Memory leaks using refcursors
Date
Msg-id 1d4e0c10701180646p56c18dcal2cb3526bd1050e63@mail.gmail.com
Whole thread Raw
In response to Memory leaks using refcursors  ("Guillaume Smet" <guillaume.smet@gmail.com>)
Responses Re: Memory leaks using refcursors
List pgsql-jdbc
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 <davec@postgresintl.com> 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

pgsql-jdbc by date:

Previous
From: Todd Shoemaker
Date:
Subject: Default numeric scale of zero in JDBC?
Next
From: Todd Shoemaker
Date:
Subject: Re: Default numeric scale of zero in JDBC?