As my program steps through a dictionary and inserts records, my memory usage creeps up until I get a failure in my code. I am opening my connection to Oracle at the beginning and then just reuse the same connection during the entire process. So, calling the following code with a large insert statement rougly 100,000 times causes an Out of Memory exception. I am not sure how to reset things??
C#:
public int ExecuteNonQuery(string sql) {
try
{
//conn.Open();
int affected;
//Debug.WriteLine("Connection: " + this.conn.InstanceName);
OracleCommand cmd = conn.CreateCommand();
cmd.CommandText = sql;
cmd.Connection = conn;
affected = cmd.ExecuteNonQuery();
//mytransaction.Commit();
return affected;
}
catch (Exception ex)
{
Console.WriteLine("OracleDataAccessManager.ExecuteNonQuery(): " + ex);
throw ex; //Acts the same as a return.
}
finally
{
//conn.Close(); //Not using this section
}
}