Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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.


In response to


pgsql-jdbc by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group