Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> JDBC OCI7 memory leak..?
Hello,
I was experiencing strange memory leaks in my server-side code. After trying a simple test program (included at the bottom), I came to the conclusion that it must be the oci7 driver that leaks memory. (Using liboci73.so, dowloaded from Oracle today.)
During execution, the Runtime.totalMemory() remains at the same level. But observing the actual memory usage for the Java Virtual Machine, you can see that it keeps on growing.
I have also tried other variations where I only made one connection and a large number of selects. This had the same effect.
Comments please!
Here is the source code for the test program:
import java.sql.*;
public class Oci7MemoryLeak
{
public static void main(String args[])
{
try {
Class driver = Class.forName("oracle.jdbc.driver.OracleDriver"); Connection c = null; String query = "SELECT * FROM TAB"; // dummy query Statement s; while(true) { try { c = DriverManager.getConnection("jdbc:oracle:oci7:@mydb", "user", "password"); System.out.print("Connected.."); s = c.createStatement(); s.executeQuery(query); System.out.println(" ..query executed.");
}
catch(SQLException se) { se.printStackTrace();
}
finally { Thread.sleep(1000); // sleep for a while try { c.close(); } catch(SQLException se) { se.printStackTrace(); } System.out.println("Disconnected"); System.out.println("Memory: " + Runtime.getRuntime().totalMemory());
}
}
/Per Widerlund Received on Tue Jul 28 1998 - 05:27:41 CDT
![]() |
![]() |