7 Replies Latest reply: Sep 25, 2012 5:32 AM by 963503 RSS

    Memory leak in 11g ODP.NET (

      I have code that works fine in ODP.NET ( and Oracle 10g server. There is no memory leak. Because I tried to dispose everything every time when I done. The memory stays at 1.2G level while I read/write milliions records.

      But the same code gave me momery leak when running in ODP.NET I run my code in Windows 7 (32bit). Based on my watch from task manager, when the machine RAM reaches 2G, I don't see memory increasing any more. But after running for some time with that memory level (2G), it eventually throws out of memory exception.

      Any one has any idea?
        • 1. Re: Memory leak in 11g ODP.NET (
          In the company I work the same problem happened. And since we checked, even in newer versions of ODP.NET the problem continues. To our knowledge this connected to the connection pool.

          As a solution had to disable the connection pool. Just insert the connection string token:; Pooling = false;. But is not the ideal solution because the system becomes slower to open connections. If you loop that are opening and closing connections the system will become much slower.

          Details on some systems written in C # our error does not occur with the same implementation.

          Check also that all objects that are used in the database are being released:

          OracleConnection = Dispose
          OracleCommand = Dispose
          OracleReader = Close and Dispose

          Edited by: 893128 on Nov 3, 2011 12:30 PM

          Edited by: 893128 on Nov 3, 2011 12:30 PM
          • 2. Re: Memory leak in 11g ODP.NET (
            I tried "pooling=false", but it doesn't seem to work for me. During the test, I still see memory usage keep increasing. I have one connection and keep reading/writing data using the same connection.
            • 3. Re: Memory leak in 11g ODP.NET (
              same problem here .. the memory usage on Win2008R2 with ODP.net ( is about twice as high as with odp.net 10gR2 (
              • 4. Re: Memory leak in 11g ODP.NET (
                Alex.Keh .Product.Manager-Oracle
                If someone can give me a reproducible test case, I can file a bug for you. If the test case is difficult to reproduce, then I recommend opening up a support ticket to diagnose and fix the problem or provide you a fix if one is available.
                • 5. Re: Memory leak in 11g ODP.NET (
                  I experienced the memory leak in 11g ODP.NET

                  The testbed for testing the memory leak consists of 75 threads and querying 500 rows in each thread.
                  There were 6 columns of type CLOB in each row of the table.I created a simple console application with the above testbed.
                  The memory leak were found in the following scenarios mentioned below.

                  Type ODP.NET Version Oracle Server Finding
                  DataReader Oracle11g No Error
                  DataReader Oracle 10g OracleException:Memory could not be allocated
                  DataSet Oracle 11g System.OutOfMemoryException
                  DataSet Oracle 10g System.OutOfMemoryException

                  The stack Trace of SystemOutOfMemoryException is as follows and points to OracleDataReader.

                  System.String.CtorCharCount(Char c, Int32 count)\r\n at Oracle.DataAccess.Client.OracleDataReader.GetString(Int32 i)\r\n at Oracle.DataAccess.Client.OracleDataReader.GetValue(Int32 i)\r\n at Oracle.DataAccess.Client.OracleDataReader.GetValues(Object[] values)\r\n at System.Data.ProviderBase.DataReaderContainer.CommonLanguageSubsetDataReader.GetValues(Object[] values)\r\n at System.Data.ProviderBase.SchemaMapping.LoadDataRow()\r\n at System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping)\r\n at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)\r\n at System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)\r\n at Oracle.DataAccess.Client.OracleDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)\r\n at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)\r\n at Oracle11gMemLeakAnalysis.DataAdaptor.GetDataTable(String query, OracleConnection DatabaseConnection) in D:\\Oracle11gMemLeakAnalysis\\Oracle11gMemLeakAnalysis\\DataAdaptor.cs:line 40\r\n at Oracle11gMemLeakAnalysis.DataAdaptor.RetriveDataTable(String query, OracleConnection DatabaseConnection) in D:\\Oracle11gMemLeakAnalysis\\Oracle11gMemLeakAnalysis\\DataAdaptor.cs:line 23\r\n at Oracle11gMemLeakAnalysis.Program.GetAllData() in D:\\Oracle11gMemLeakAnalysis\\Oracle11gMemLeakAnalysis\\Program.cs:line 71\r\n at Oracle11gMemLeakAnalysis.Program.LongRunningProcess(Object input) in D:\\Oracle11gMemLeakAnalysis\\Oracle11gMemLeakAnalysis\\Program.cs:line 46"

                  Can someone help me how to solve this memory leack issue with ODP.NET
                  • 6. Re: Memory leak in 11g ODP.NET (
                    Alex.Keh .Product.Manager-Oracle
                    I didn't find any open bugs specifically involving DataReader or LOBs that were still open for ODP.NET 11.2 in Oracle's Bug DB. That's not to say the bug you have is necessarily new and not fixed yet. The bug may exist and/or be fixed already, but may not be filed under ODP.NET. If a dependent component is causing the problem, such as OCI, then the bug would be filed under those components.

                    First thing I would recommend is downloading the latest ODP.NET patch for from My Oracle Support and see if the problem reproduces. If so, then open a service request with Oracle Support to have them diagnose, then provide a fix. It's virtually impossible to diagnose the root cause of a memory leak under high load via discussion forum.
                    • 7. Re: Memory leak in 11g ODP.NET (
                      Hi Alex,
                      This is a folllow-up of the previous mail from 952201
                      I have carried out the below steps to resolve the ODP.NET MemLeak issue by installing Patach 14543813 on my my Windows 7 32-Bit PC:

                      1.     Uninstalled earlier versions of ODP.NET.
                      2.     Installed ODP.NET
                      3.     Ran my MemLeak Check app. From VS2010. This resulted in MemLeak & the System.OutOfMemoryException(). This was captured in a log file.
                      4.     Installed 14543813 Patch.
                      5.     After installation it was observed that there was a connection issue which was not there before.
                      6.     On Comparing the directories of the earlier dir vs Patch dir, using WinDiff, these were the files that were added extra in the Patch version:
                      i product\11.2.0\client_1\bin\oramts.dll
                      viii. product\11.2.0\client_1\bin\oraoledbrmc11.dll
                      7.     Strangely the Oracle.DataAccess.dll remains the same before & after the Patch install.

                      The Patch 14543813 was supposed to have fixed the Bug 10084752 (MEMORY LEAK USING ORACLEBULKCOPY). But to check the same the Oracle connection does not seem to work. I have followed all the installation steps correctly. Kindly point me in the right direction to resolve the connection issue.


                      Edited by: 960500 on Sep 25, 2012 3:27 AM