Re: Memory leaks using refcursors

From: "Guillaume Smet" <guillaume(dot)smet(at)gmail(dot)com>
To: "Dave Cramer" <davec(at)postgresintl(dot)com>, "PostgreSQL JDBC" <pgsql-jdbc(at)postgresql(dot)org>
Cc: thierry(dot)buffet(at)fr(dot)nurun(dot)com
Subject: Re: Memory leaks using refcursors
Date: 2007-01-18 14:46:26
Message-ID: 1d4e0c10701180646p56c18dcal2cb3526bd1050e63@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)postgresintl(dot)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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Todd Shoemaker 2007-01-18 17:05:51 Re: Default numeric scale of zero in JDBC?
Previous Message Todd Shoemaker 2007-01-18 14:05:42 Default numeric scale of zero in JDBC?