possible memory leak?? - Mailing list pgsql-jdbc

From Dave Cramer
Subject possible memory leak??
Date
Msg-id 1036761105.12348.10.camel@inspiron.cramers
Whole thread Raw
In response to DatabaseMetaData.getTables problem  (snpe <snpe@snpe.co.yu>)
Responses Re: possible memory leak??  (Mike Beachy <beachy@marketboy.com>)
List 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@micro-automation.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();
  }
}


pgsql-jdbc by date:

Previous
From: snpe
Date:
Subject: DatabaseMetaData.getTables problem
Next
From: "Michael Paesold"
Date:
Subject: Re: possible memory leak??