Long running open connections badly leak memory

From: Joerg von Frantzius (joerg.von.frantzius_at_artnology.REMOVE.com)
Date: 02/18/05


Date: Fri, 18 Feb 2005 13:36:21 +0100

Hi,

I wrote a batch import process that uses connection pooling, i.e. the
connections are never closed until the process is finished. I am writing
large chunks of data (byte[]) into the database, and I made absolutely
sure that my application does not hold any references to the byte[]
objects. However, the process increasingly consumes memory until an
OutOfMemoryError, and I tracked it down to the Microsoft JDBC driver
still holding references to the byte[] objects. The workaround is to
clear the pool "from time to time", closing its connections. When I do
that, the memory is properly reclaimed by the GC.

This "from time to time" involves some unsatisfying heuristics, though
(apart from the inconvenience of having to find the pool and access it).

If the driver is doing any caching on purpose, it should be documented
somewhere, and it should be configurable. My guess is that it's not on
purpose, though. I can't see much sense in holding on to written data
after a transaction is finished.

In case any driver developer should be interested, using a profiling
tool I found references from the following driver classes to a byte[]
object that should normally be reclaimed by the GC:
com.microsoft.jdbc.sqlserver.SQLServerPacketizingDataConsumer and
com.microsoft.jdbc.sqlserver.tds.TDSConnection

Regards,
Jörg.



Relevant Pages

  • Re: System 6 six master display driver board
    ... connections between MPU board, display driver, driver and slave cables, and ... If you see dark stains between the pins, ... Vibration problem while you're playing game affecting digits could be due to ... bad connections between MPU and driver board- interruptions in the ...
    (rec.games.pinball)
  • Asus A8V-E Deluxe and USB ports not working proporly
    ... Cool & Quiet Utility v1.022 and AMD CPU Driver v1.2.2.0 in Windows. ... had it not been that I sometimes loose the connections to my mouse and ... the drive is connected through the front or the rear USB-ports. ...
    (alt.comp.periphs.mainboard.asus)
  • Re: [PATCH RFD] alternative kobject release wait mechanism
    ... simplier just to use a reference to struct device instead of embedding ... drvdata belongs to driver that is bound to a device. ... The problem is that device structures carry references to their parents. ... providers offering char device registration performs immediate detach -- ...
    (Linux-Kernel)
  • Re: RAC, the Listener and Weblogic
    ... be accessing via weblogic and we are working to connect the two using the JDBC thin driver. ... like the connections to failover to the remote oracle node with minimal ... (SERVER = DEDICATED) ... In a rac node failure situation, ...
    (comp.databases.oracle.server)
  • Re: Websphere, zIIPs and zAAPs
    ... With the type 4 driver, you will have to watch how far into the network ... but I plan to look at the zIIPs once we get the correct hardware ... We have DDF drop connections after three minutes of no ... on the new System z with zAAPs and zIIPs. ...
    (bit.listserv.ibm-main)