db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juan Ignacio Villa <ji_vi...@yahoo.es>
Subject Garbage Collector and memory
Date Mon, 24 Oct 2005 09:37:58 GMT
Hello.

My java application uses memory more and more until it
crash. It is strange because not use new variables nor
I do not create them dynamically. I have an for with
which I make select SQL by means of inserted dynamic
values. The peculiar thing is that in each return of
for for, the program uses memory more and more, but I
do not create new variables, but reusing same
variables. I proved to garbage it with runtime.gc but
there was no difference. Dont free it. 

I can do it of other way, but I have discovered that
gc does not work to me in the application. It does not
release memory until the application finalizes, and
cannot be in a server application. 
It is necessary to make some extra task to release
statements, resultsets or connections? 
The used memory comes from another part? 

derbydev.pdf tells that the memory to gc is closed
normally. Also I have seen that driver it maintains a
list of resultset not closed and does not release the
memory.

My code is:

Class.forName"org.apache...");
java.sql.Connection DbConexion =
DriverManager.getConnection("jdbc:derby:" + addpath
+"/prueba....");

String sql ="";
Statement Consulta =null;
ResultSet Rs = null;

for (int i=1; i<400; i++) {
  sql="SELECT * FROM tipo2 WHERE " + consul[i];
  Consulta =
DBConexion.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
  Rs = Consulta.executeQuery(sql);
  Rs.close();
  Rs = null;
  Consulta.close();
  Consulta = null;
}

try{
  Rs.close();
  Consulta.close();
  Rs = null;
  Consulta = null;
}catch(...)


Variable declarations must be into for, but result is
the same.


Greetins.


		
______________________________________________ 
Renovamos el Correo Yahoo! 
Nuevos servicios, más seguridad 
http://correo.yahoo.es

Mime
View raw message