Page 1 of 1

Memory Leak in Devart 7.* with Parameter OracleTimeStamp

Posted: Wed 12 Mar 2014 14:42
by klaus linzner
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?

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();
    }
}

Re: Memory Leak in Devart 7.* with Parameter OracleTimeStamp

Posted: Fri 14 Mar 2014 15:46
by Pinturiccio
We have improved the performance of the operation of assigning TIMESTAMP and INTERVAL values to In/InOut parameters and fixed memory leak in this operation in dotConnect for Oracle 8.1.36. For more information, please refer to http://www.devart.com/dotconnect/oracle ... story.html
klaus linzner wrote: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?
Unfortunately the fix for the bug was related to modifying our internal code and there is no workaround for the issue.
klaus linzner wrote:Devart 8.3 works like a charm but migration of our core libraries to 8.* is for now out of reach (sadly).
New functionality and bug fixes are included into new builds of dotConnect for Oracle. The only way to get the fix for the issue is to use dotConnect for Oracle 8.1.36 or higher.

Re: Memory Leak in Devart 7.* with Parameter OracleTimeStamp

Posted: Wed 19 Mar 2014 23:44
by klaus linzner
Pinturiccio wrote:We have improved the performance of the operation of assigning TIMESTAMP and INTERVAL values to In/InOut parameters and fixed memory leak in this operation in dotConnect for Oracle 8.1.36. For more information, please refer to http://www.devart.com/dotconnect/oracle ... story.html
...
New functionality and bug fixes are included into new builds of dotConnect for Oracle. The only way to get the fix for the issue is to use dotConnect for Oracle 8.1.36 or higher.
Is there any way we can achieve by calling the relevant code portions via Reflection?

An out-of-schedule update to 8.x without releasing a new major version of our product is simply not possible as I've seen that some API's changed and a quick run on our testcases showed some differences in behavior as well. But then, releasing a new major version of our product for a bugfix is useless as existing applications would require to update their major as well...

Re: Memory Leak in Devart 7.* with Parameter OracleTimeStamp

Posted: Fri 21 Mar 2014 12:26
by Pinturiccio
The bug was fixed in dotConnect for Oracle 8.1.36. There is no way to get the fix in earlier versions.