I have a .Net service application that interfaces with our production database (v7.6.0.12 on a separate server under Solaris 9) using the ODBC data provider (System.Data.Odbc) in .Net framework v1.1.4322. I'm using the Windows MaxDB ODBC driver version 7.6.0 b016 (MDAC 2.81.1117.0) with Connection Pooling enabled. The service appears to leak memory whenever the load increases to the point where it must open further data base connections. When the load decreases and these extra connections are not needed the connection pool begins closing these sessions, however not all the memory appears to be released.
As an experiment, I wrote the following simple application and observed that its memory footprint also continues to increase over time. The application repeatedly opens a connection; calls a stored procedure and retrieves the results; and then pauses long enough for the connection pool to close the connection. I have used the "using" clause to ensure there are no connection leaks. Does anyone have any suggestions? using System; using System.Data.Odbc; namespace TestApp { class TestApp { [STAThread] static void Main(string[] args) { for (int i = 0; i < 1000; i++) { try { using(OdbcConnection dbconn = new OdbcConnection("DSN=GWDB_T;UID=<user>;PWD=<pwd>")) { dbconn.Open(); using(OdbcCommand dbcmd = new OdbcCommand("CALL DBA.SP251_GETSTATUS (?,?,?,?)",dbconn)) { dbcmd.CommandType = System.Data.CommandType.StoredProcedure; dbcmd.Parameters.Add("I_DEVICESERIALNUM",Convert.ToDouble("000020")); dbcmd.Parameters.Add("O_ISACTIVE", OdbcType.Char, 1); dbcmd.Parameters["O_ISACTIVE"].Direction = System.Data.ParameterDirection.Output; dbcmd.Parameters.Add("O_DEVICESERIALNUM", OdbcType.Double); dbcmd.Parameters["O_DEVICESERIALNUM"].Direction = System.Data.ParameterDirection.Output; dbcmd.Parameters.Add("O_RETCODE", OdbcType.Char, 10); dbcmd.Parameters["O_RETCODE"].Direction = System.Data.ParameterDirection.Output; int rc = dbcmd.ExecuteNonQuery(); string o_isactive = dbcmd.Parameters["O_ISACTIVE"].Value.ToString(); string o_deviceserialnum = dbcmd.Parameters["O_DEVICESERIALNUM"].Value.ToString(); string o_retcode = dbcmd.Parameters["O_RETCODE"].Value.ToString(); } // using dbcmd - should automatically dispose command object } // using dbconn - should automatically dispose connection object } catch { } finally { /* Pause application long enough for Connection Pool to close previous connection, in this case I have set the time that unused connections remain in pool to 10 seconds */ System.Threading.Thread.Sleep(15000); } } // for loop } // End of Main } } Terry Gifford Tacoma Power - Advanced Metering Project