pgsql/src/interfaces/jdbc/org/postgresql/jdbc1 (PreparedStatement.java ResultSet.java)

From: momjian(at)postgresql(dot)org
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql/src/interfaces/jdbc/org/postgresql/jdbc1 (PreparedStatement.java ResultSet.java)
Date: 2000-12-28 23:56:46
Message-ID: 200012282356.eBSNukJ02078@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Date: Thursday, December 28, 2000 @ 18:56:46
Author: momjian

Update of /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1
from hub.org:/home/projects/pgsql/tmp/cvs-serv2062/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1

Modified Files:
PreparedStatement.java ResultSet.java

----------------------------- Log Message -----------------------------

Attached are patches for two fixes to reduce memory usage by the JDBC
drivers.

The first fix fixes the PreparedStatement object to not allocate
unnecessary objects when converting native types to Stings. The old
code used the following format:
(new Integer(x)).toString()
whereas this can more efficiently be occompilshed by:
Integer.toString(x);
avoiding the unnecessary object creation.

The second fix is to release some resources on the close() of a
ResultSet. Currently the close() method on ResultSet is a noop. The
purpose of the close() method is to release resources when the ResultSet
is no longer needed. The fix is to free the tuples cached by the
ResultSet when it is closed (by clearing out the Vector object that
stores the tuples). This is important for my application, as I have a
cache of Statement objects that I reuse. Since the Statement object
maintains a reference to the ResultSet and the ResultSet kept references
to the old tuples, my cache was holding on to a lot of memory.

Barry Lind

Browse pgsql-committers by date

  From Date Subject
Next Message vadim 2000-12-29 08:08:59 pgsql/src/backend/access/nbtree (nbtree.c)
Previous Message petere 2000-12-28 17:34:52 pgsql/contrib/rserv (Makefile)