Bug #9661 HEAP overflow
Submitted: 5 Apr 2005 19:34 Modified: 5 Apr 2005 19:53
Reporter: [ name withheld ] Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / J Severity:S1 (Critical)
Version:3.1.7 OS:Linux (Linux (FC2 and/or Gentoo))
Assigned to: CPU Architecture:Any

[5 Apr 2005 19:34] [ name withheld ]
Description:
There is a bug in a version 3.1.7 in jConncetor with freeing memory, garabge collector doesn't free memory neither in force attempt. Program is still using more memory untill it crash with HEAP overflow. In version 3.0.16 it's freeing memory correctly. If you want I can send source code of my Java program. MySQL server version:  3.23.58
thx for help

How to repeat:
Everytime

Suggested fix:
Use older version
[5 Apr 2005 19:53] Mark Matthews
Chances are you're not calling .close() on statements or result sets, which the JDBC specification _requires_ you to do.

Connector/J 3.0.x was more lenient about this. In order to meet the requirements of the JDBC compliance test, Connector/J 3.1.x is required to maintain references to all open statements and result sets, therefore if _your_ code doesn't close them, it will look like a memory leak.

You might try setting 'dontTrackOpenResources=true' in your JDBC url if you're not able to fix your non-JDBC-compliant code.

Connector/J 3.1.8 uses finalizers to take care of some of this automatically for you, but 1) You can't count on it always working and 2) It's very bad practice for JDBC client code to not call .close() on resources as soon as it's done with them.