possible memory leak??

From: Dave Cramer <Dave(at)micro-automation(dot)net>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: possible memory leak??
Date: 2002-11-08 13:11:45
Message-ID: 1036761105.12348.10.camel@inspiron.cramers
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

If I run the following program for an extended period of time the
memory consumed by java keeps increasing 4M at a time. Can anyone else
confirm this, and next; can anyone explain why? Is this normal? I doubt it, but
can't confirm it?

Does anyone have access to an optimizer to run this on?

--
Dave Cramer <Dave(at)micro-automation(dot)net>
import java.lang.Runnable;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
*/

public class TestRoutes implements Runnable
{
Connection con;

public TestRoutes()
{

try
{
Class.forName("org.postgresql.Driver");
con = DriverManager.getConnection("jdbc:postgresql://localhost/symcor", "davec", "" );
}
catch ( Exception ex)
{
ex.printStackTrace();
}

}
public void selectRoutes()
{
Statement stmt = null;
ResultSet rs = null;
try
{
stmt = con.createStatement();
rs = stmt.executeQuery("select * from route");
for( int i=0; rs.next(); i++ )
{
System.out.println( "Route " + i );
}
}
catch ( Exception ex )
{
ex.printStackTrace();
}
finally
{
try
{
rs.close();
stmt.close();
rs=null;
stmt=null;
}
catch (SQLException ex)
{
}
}

}
public void run()
{

while(true)
{
try
{
//RouteModel.getAllRoutes();
selectRoutes();
Thread.sleep(2000);
}
catch( Exception ex )
{
return;
}
}
}
public static void main( String [] args )
{
TestRoutes t = new TestRoutes();
new Thread(t).start();
}
}

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Michael Paesold 2002-11-08 13:31:47 Re: possible memory leak??
Previous Message snpe 2002-11-07 22:22:57 DatabaseMetaData.getTables problem