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

Two minor fixes to reduce resource usage in JDBC drivers

From: Barry Lind <barry(at)xythos(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Two minor fixes to reduce resource usage in JDBC drivers
Date: 2000-12-26 20:44:30
Message-ID: 3A49032E.BBD063FF@xythos.com (view raw or flat)
Thread:
Lists: pgsql-interfacespgsql-patches
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.

thanks,
--Barry

Attachment: patch.diff
Description: text/plain (5.2 KB)

Responses

pgsql-patches by date

Next:From: Brent VernerDate: 2000-12-26 20:47:37
Subject: Re: Tuple-valued datums on Alpha (was Re: 7.1 on DEC/Alpha)
Previous:From: Tom LaneDate: 2000-12-26 19:41:33
Subject: Re: Tuple-valued datums on Alpha (was Re: 7.1 on DEC/Alpha)

pgsql-interfaces by date

Next:From: Bruce MomjianDate: 2000-12-27 05:56:26
Subject: PHP and PostgreSQL
Previous:From: Adam LangDate: 2000-12-26 13:44:29
Subject: Re: PG on a web-server...issues..and some general questions on PG deployment

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