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

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

My code is:

java.sql.Connection DbConexion =
DriverManager.getConnection("jdbc:derby:" + addpath

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

for (int i=1; i<400; i++) {
  sql="SELECT * FROM tipo2 WHERE " + consul[i];
  Consulta =
  Rs = Consulta.executeQuery(sql);
  Rs = null;
  Consulta = null;

  Rs = null;
  Consulta = null;

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


Renovamos el Correo Yahoo! 
Nuevos servicios, más seguridad 

View raw message