-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.0
-
x86
-
windows_nt
Name: gm110360 Date: 09/12/2001
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
We have found a serious memory leak using the Sun JDBC/ODBC bridge to access
values of type DATE. Running under a normal load on a small test server our
Web application will run out of memory in less than 12 hours.
///////////////////////////////////////////////////////////////////////////////
/** This class demonstrates a memory leak in the JDBC-ODBC bridge.
**/
import java.sql.*;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
public final class Example
{
///////////////////////////////////////////////////////////////////////////
private static final String JDBC_DRIVER =
"sun.jdbc.odbc.JdbcOdbcDriver";
// Example JDBC URL's - note that the site specific info has been stripped
private static final String JDBC_URL =
"jdbc:odbc:;driver=Oracle ODBC Driver;server=;dbq=;uid=;pwd=";
// "jdbc:odbc:;driver=Microsoft ODBC for Oracle;server=;uid=;pwd=";
// "jdbc:odbc:;driver=SQL Server;server=;database=;uid=;pwd=";
private static final String JDBC_QUERY =
"SELECT SYSDATE FROM DUAL";
// "SELECT GETDATE()";
private static final long ITERATION_COUNT = 30000;
///////////////////////////////////////////////////////////////////////////
public static void main(String[] arguments)
{
try {
Class.forName(JDBC_DRIVER);
Connection connection = DriverManager.getConnection(JDBC_URL);
for (long i = 0; i < ITERATION_COUNT; ++i) {
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(JDBC_QUERY);
int columnCount = resultSet.getMetaData().getColumnCount();
while (resultSet.next()) {
for (int c = 1; c <= columnCount; ++c) {
Object value = resultSet.getObject(c);
}
}
resultSet.close();
statement.close();
}
connection.close();
} catch (Exception ex) {
System.err.println("Exception: " + ex);
}
}
///////////////////////////////////////////////////////////////////////////
}
///////////////////////////////////////////////////////////////////////////////
We have demonstrated the leak on systems with the following configurations:
System 1:
OS: Windows NT version 4.00.1381
Java VM(s): HotSpot Client VM 1.3.1-b24
HotSpot Client VM 1.3.0-C
HotSpot Client VM 1.4.0-beta2-b77
ODBC: 3.510.4202.0
ODBC drivers: Microsoft ODBC for Oracle 2.573.4202.0
Oracle ODBC Driver 8.01.06.00
SQL Server 3.70.06.90
System 2:
OS: Windows NT 4.00.1381
Java VM: HotSpot Client VM 1.3.1-b24
ODBC: 3.510.4202.0
ODBC drivers: Microsoft ODBC for Oracle 2.573.4202.0
Oracle ODBC Driver 8.00.05.00
SQL Server 3.70.06.90
System 3:
OS: Windows 2000 5.00.2195
Java VM: HotSpot Client VM 1.3.1-b24
ODBC: 3.520.5303.2
ODBC drivers: Microsoft ODBC for Oracle 2.573.5303.00
Oracle ODBC Driver 8.00.05.00
SQL Server 3.70.08.21
(Review ID: 131434)
======================================================================
- duplicates
-
JDK-4478644 Memory leak in native code when calling ResultSet's getTimestamp() method
-
- Resolved
-