FreeTDS JDBC Out of Memour error

Bob Kline bkline at
Tue Dec 21 15:51:00 EST 1999

On Tue, 21 Dec 1999, jenzinas wrote:

> I'm having a problem with my application.
> I'm running under JDK 1.1.8 on a Win NT box accessing into an MS SQL
> 7.0 server.
> after running for a while (at least a couple of hours), my
> application will throw an exception like so:
> ava.lang.OutOfMemoryError
> [stack details omitted]
> i can't see any problems with memory in the TaskManager but this is
> the Exception that is thrown. Any one have any ideas? or am i on the
> wrong FreeTDS list?

The garbage collection mechanism is holding onto blocks of memory so
that over time you are exceeding the limit set for your VM.  A couple of
things you can do to address/work around this problem.

1. Bump up the limit (see the docs for the -mx command line option).
2. Eliminate references to objects you no longer need.

Note that in some cases #2 can be difficult or even impossible.  There
are tools around which can help you track down such references (JProbe
and OptimizeIt for example, as well as one or two free utilities), but
there are also some bugs in some versions of Sun's libraries (most
notorious ones are in Swing) which hold onto references in ways that can
undermine all your assumptions about how the garbage collection will
perform.  If a low-level object A contains a reference to object B,
which in turn contains a reference to object C, which in turn contains
...., and A is never set to null, then none of the space for these
objects gets freed up.  Now imagine that B, C, D, etc. are arrays.  You
can see why you might run out of memory more quickly than you might
originally have thought.

In most cases, #1 above merely postpones the exception rather than
eliminating it.

Bob Kline
mailto:bkline at

More information about the FreeTDS mailing list