Memory Leak in Devart 7.* with Parameter OracleTimeStamp
Posted: Wed 12 Mar 2014 14:42
I noticed a memory leak when executing an OracleCommand that contains OracleTimeSTamp parameter. So far the issue is reproducible with DevArt 7.2.114, 7.9.333 and Oracle.DataAccess as well. Devart 8.3 works like a charm but migration of our core libraries to 8.* is for now out of reach (sadly).
When running below sample unmanaged memory grows in module oci.dll, as soon as the OracleConnection itself is disposed it's freed again.
Do you know of any workarounds (besides disposing and creating a new connection) for this fix or is there any newer 7.* besides 7.9.333 that could work as well?
When running below sample unmanaged memory grows in module oci.dll, as soon as the OracleConnection itself is disposed it's freed again.
Do you know of any workarounds (besides disposing and creating a new connection) for this fix or is there any newer 7.* besides 7.9.333 that could work as well?
Code: Select all
internal class MemoryTestDevart
{
private const string SqlSpMemTest = "SP_MEM_TEST_TIMESTAMP";
private const string SqlSpMemTestParam = "P_CONTENT_DATETIMEOFFSET";
private const int StatementsPerLoop = 1000;
private const int Loops = 10000;
private const string ConnectionString =
"Data Source=YOURHOST;Persist Security Info=True;User ID=YOURUSER;Password=YOURPASS;Pooling=false";
private static void Main(string[] args)
{
using (OracleConnection connection = new OracleConnection(ConnectionString))
{
Console.Write("Start connect");
connection.Open();
for (int currentLoop = 0; currentLoop < Loops; currentLoop++)
{
OracleTimeStamp[] valuesDateTimeOffset = new OracleTimeStamp[StatementsPerLoop];
Parallel.For(0, StatementsPerLoop,
current => { valuesDateTimeOffset[current] = new OracleTimeStamp(DateTime.Now); });
Stopwatch stopExecution = Stopwatch.StartNew();
using (OracleTransaction transaction = connection.BeginTransaction())
{
using (OracleCommand executionCommand = new OracleCommand(SqlSpMemTest, connection))
{
executionCommand.Transaction = transaction;
executionCommand.CommandType = CommandType.StoredProcedure;
executionCommand.Parameters.Add(new OracleParameter(
SqlSpMemTestParam,
OracleDbType.TimeStamp,
valuesDateTimeOffset,
ParameterDirection.Input));
executionCommand.ExecuteArray(valuesDateTimeOffset.Length);
}
transaction.Commit();
}
stopExecution.Stop();
Console.WriteLine("Loop # {0} took {1} ms", currentLoop, stopExecution.ElapsedMilliseconds);
}
Console.WriteLine("Press enter to continue (it will dispose oracleConnection - memory should be freed)");
Console.ReadLine();
Console.WriteLine("Disposing connection");
}
Console.WriteLine("Check memory - it should be lower now");
Console.ReadLine();
}
}