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

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Any known memory leaks in the driver ... ?
Дата
Msg-id 4020224B.6070406@opencloud.com
обсуждение исходный текст
Ответ на Any known memory leaks in the driver ... ?  ("Marc G. Fournier" <scrappy@postgresql.org>)
Список 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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: Error While trying to use Functions which return Resultsets
Следующее
От: Mofeed Shahin
Дата:
Сообщение: Re: metadata searching