  | | | Huge memory consumed with myOdbc and VB.NET | Huge memory consumed with myOdbc and VB.NET 2006-05-03 - By Patrik Lindvall
Back
Hi All!
When using MyOdbc3.51.12 with VB.net(1.1) and filling a dataset from table all available memory get consumed after a couple of 500 queries.
The problem only arises with tables that contains a huge amount of records(>100000) and that leads me to the conclusion that the whole table for some reason gets into odbcmemory, and performance is also lousy.
The datatable in the dataset only contains the row from query (SELECT * from XXX Where ID='1') and ID is primary KEY.
The problem only arises when Dataadapter.MissingSchemaAction = MissingSchemaAction.AddWithKey is used in dataadapter, without that line the problem does not show!
The program runs without problem on 2003-server/wts and ordinary window clients.
The problemserver is an 2003 windows server std edition SP1 citrix metaframe (4.0.17-max-debug /odbc 3.51.12)
The program exits after 500 queries on dataadapter.fill with exception, "Object reference not set to an instance of an object" and about 1.5 GB memory is consumed!
Any help on this issue is appreciated!
Regards
Patrik
Vb-code:
Imports System.Data.Odbc
Module Module1
Private cn As OdbcConnection
Private Dataadapter As OdbcDataAdapter
Sub Main()
Dim ds As New DataSet
Dim sql As String
Dim count as integer = 10000
cn = New OdbcConnection("DSN=test")
sql = "SELECT * FROM xxx where id= '1'"
Try
cn.Open()
Dataadapter = New OdbcDataAdapter(sql, cn)
Dataadapter.MissingSchemaAction = MissingSchemaAction.AddWithKey '*** When removing this line the isue doesn't arise!!! ***
Catch ex As Exception
Console.WriteLine(ex.Message)
Console.ReadLine()
End
End Try
Do
Try
Dataadapter.Fill(ds, "table")
Catch ex As Exception
Console.WriteLine("Count:" & Count & vbCrLf & ex.Message)
'"Object reference not set to an instance of an object" after about 500 queries"
Exit Do
End Try
'Do som work!
If Count Mod 100 = 0 Then
Console.Write(Count & ",(" & ds.Tables(0).Rows.Count & ")")
End If
ds.Tables("xxx").Clear()
Count -= 1
Loop Until Count <= 0
End Sub
End Module
|
|
 |