Memory issues with DataAdapter

Memory issues with DataAdapter

Postby gravem » Tue 03 Nov 2009 15:12

I've been getting out of memory problems when loading a large amount of rows into Oracle. Some of the text files we load have over 2 million rows.

I've run the same thing in System.Data.OracleClient and haven't had the same problem.

For example (memory usage) :
Application starts: 14,344K

Devart inserting 50,000 rows: 50,668K
Devart inserting 100,000 rows: 69,200K

OraClient inserting 50,000 rows: 32,480K
OraClient inserting 100,000 rows: 32,220K

There is no memory issue if I am just calling the insert procedure for every row I want to insert... but to batch rows... I am using a dataadapter with UpdateBatchSize=100... because it is way faster.

Below is the code used for the test. The table being inserted into has 3 columns only.... the procedure being called is just inserting a row into this table.

Code for DevArt test:
Public Sub TestDevArt
Dim conn As New Devart.Data.Oracle.OracleConnection

Dim insertCmd As Devart.Data.Oracle.OracleCommand = New Devart.Data.Oracle.OracleCommand
With insertCmd
.Connection = conn
.CommandType = CommandType.StoredProcedure

.Parameters.Add("p_file_id", Devart.Data.Oracle.OracleDbType.Number, 0, "FILE_ID").Direction = ParameterDirection.Input
.Parameters.Add("p_data_seq", Devart.Data.Oracle.OracleDbType.Number, 0, "DATA_SEQ").Direction = ParameterDirection.Input
.Parameters.Add("p_data_value", Devart.Data.Oracle.OracleDbType.VarChar, 2000, "DATA_VALUE").Direction = ParameterDirection.Input
End With

Dim dt As New DataTable
dt.Columns.Add(New DataColumn("FILE_ID", GetType(Int64)))
dt.Columns.Add(New DataColumn("DATA_SEQ", GetType(Int64)))
dt.Columns.Add(New DataColumn("DATA_VALUE", GetType(String)))

Dim da As New Devart.Data.Oracle.OracleDataAdapter()
da.InsertCommand = insertCmd
da.InsertCommand.Connection = conn
da.InsertCommand.UpdatedRowSource = UpdateRowSource.None
da.UpdateBatchSize = 100

Dim dr As DataRow


For xx As Integer = 1 To 100000
dr = dt.NewRow
dr("FILE_ID") = 1
dr("DATA_SEQ") = xx

If dt.Rows.Count > 1000 Then
End If

conn.Dispose() : conn = Nothing
End Try
End Sub
' *************************************


I found that if I move the code to create a new dataadapter inside the FOR LOOP... the memory starts being released. However, we shouldn't have to create a new dataadapter every time we want to call the Update command.

I'm hoping this is fixed in an upcoming release.


Posts: 1
Joined: Mon 02 Nov 2009 20:45

Postby Shalex » Wed 04 Nov 2009 09:43

We will investigate the issue and notify you about the results as soon as possible.
Devart Team
Posts: 7282
Joined: Thu 14 Aug 2008 12:44

Postby Shalex » Wed 04 Nov 2009 13:38

We have fixed the bug with using OracleDataAdapter in Butch update mode on the update operation. Look forward to the next build of dotConnect for Oracle. I will post here when it is available for download.

As a temporary workaround, please use a new instance of OracleDataAdapter during every call of Update.
Devart Team
Posts: 7282
Joined: Thu 14 Aug 2008 12:44

Postby Shalex » Fri 20 Nov 2009 16:26

dotConnect for Oracle v 5.35 is released.
It can be downloaded from (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to
Devart Team
Posts: 7282
Joined: Thu 14 Aug 2008 12:44

Return to dotConnect for Oracle