Re: closing statements when connection is closed

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: closing statements when connection is closed
Date: 2004-02-10 13:59:12
Message-ID: 1076421552.16154.168.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Oliver,

Can you help me out here, I'm considering a pretty simple solution

ie WeakHashMap of every statement created, and then iterate over the
hashmap at the close and call close on the statement?

Is this overly simplistic?

Dave
On Tue, 2004-02-10 at 08:26, Oliver Jowett wrote:
> Dave Cramer wrote:
> > In the JDBC API Tutorial and Reference, it suggests that driver
> > implementors assume the worst, so I think that we should attempt to
> > clean up our clients connections as best we can.
>
> Sure. It just seems like a fair amount of work to support a case where
> we will leak memory regardless of what the driver does. The client is
> keeping the Statement/ResultSet alive, there's nothing the driver can do
> to cause GC of that object, at best all we can do is reduce the
> footprint of the leaked objects. Is doing this worth the extra
> complexity in the driver? It doesn't look like a common error to me..
>
> > On Mon, 2004-02-09 at 23:33, Oliver Jowett wrote:
> >>As far as I can see the only additional thing we'd be able to clean up
> >>is clearing the reference to row data held by open ResultSet objects.
> >>This is only going to have an effect if something outside the driver is
> >>holding references to the ResultSet or Statement after closing the
> >>connection -- which seems like an application bug to me.
>
> -O
>
--
Dave Cramer
519 939 0336
ICQ # 14675561

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Thomas Hallgren 2004-02-10 14:05:16 Re: Pl/Java 1.0.0.b now avaiable on Linux 386 and Cygwin
Previous Message Oliver Jowett 2004-02-10 13:26:19 Re: closing statements when connection is closed