Re: ps.setCharacterStream() and memory usage - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: ps.setCharacterStream() and memory usage
Date
Msg-id 4187E3E7.9080507@opencloud.com
Whole thread Raw
In response to Re: ps.setCharacterStream() and memory usage  (Sebastiaan van Erk <sebster@sebster.com>)
List pgsql-jdbc
Sebastiaan van Erk wrote:

> This is indeed part of the code I was talking about. And indeed a
> StringBuffer is already a definate improvement.
>
> However, the setString() method will also cause the data to be duplicated
> when escapeString() is called. A version of escapeString() which works
> on a StringBuffer would be another improvement in my opinion, saving
> (if the allocated StringBuffer is made a bit larger to allow for the
> escaping), in most cases another allocation of the whole string.

I would point out again that this is all different in the current
development driver. escapeString() no longer exists, and the V3 protocol
path does not do any additional string escaping as the string is passed
directly as a parameter in a Bind message.

There's still much scope for improvement, but I'd strongly suggest you
use the development driver as a starting point.

-O

pgsql-jdbc by date:

Previous
From: Vadim Nasardinov
Date:
Subject: 1300 to 3100 lines of code for XA support (was: Re: plans and estimates for supporting JDBC 3.0)
Next
From: Oliver Jowett
Date:
Subject: Re: 1300 to 3100 lines of code for XA support