Re: Any known memory leaks in the driver ... ?

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Any known memory leaks in the driver ... ?
Date: 2004-02-03 22:35:55
Message-ID: 4020224B.6070406@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Marc G. Fournier wrote:
> Subject says it all ... specifically using the 7.3.2 driver, but will be
> upgrading to 7.4.1 ... want to eliminate, if possible, the jdbc driver
> itself as being the culprit ...
>
> Checked archives, and notice talk about problems with the
> PreparedStatement stuff, but that was back in '02, so imagine that has to
> be fixed by now :) Any other gotchas, or anything fixed since 7.3.2?

The main gotcha is to make sure that you regularly clear warnings on any
Statement / Connection / ResultSet objects you retain for long periods
(see Statement.clearWarnings() etc). Some messages from the backend
(NOTICE from memory) end up as SQLWarning objects referenced by the
object that caused them, and live until explicitly cleared.

Actually, I just looked at the driver code for Statements. The javadoc
for Statement.getWarnings() claims that the warnings chain is cleared
when the statement is (re)executed, but we don't appear to do that.

Other than that I haven't noticed any real leaks in the current driver.
There are a few caches (e.g. type/oid mappings) that are long-lived but
they grow to a fixed size and stay there.

Obviously if your application is holding references to driver-created
objects that are no longer needed, you're going to leak.. but that's not
a driver bug :)

Do you have any heap info as to what type of objects your application is
leaking (and ideally, where they were allocated)?

-O

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Philip A. Chapman 2004-02-03 22:49:34 Re: Error While trying to use Functions which return
Previous Message Mofeed Shahin 2004-02-03 22:30:08 Re: metadata searching