Understanding MySQLDirect .NET Dispose

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
Posts: 6
Joined: Mon 21 Nov 2005 12:53

Understanding MySQLDirect .NET Dispose

Post by Stevod » Mon 26 Jun 2006 18:28

I am trying to locate a memory leak in my application. I would appreciate some assistance in understanding whether the disposal of mySQLCommand is operating correctly. I have run the following test code, and using a memory profiler, I see that there are up to 10,000 datareaders which remain undisposed during the life of the application. I presume that ExecuteNonQuery calls the datareader internally. Are these datareaders just waiting for the next run of the garbage collector before they will be disposed, or is this the source of the memory leak?

Many thanks.

Dim x As Integer
Dim mySQLcnn As New CoreLab.MySql.MySqlConnection("user id=xray_engine;host=localhost;database=control;direct=True;protocol=Tcp;pooling=False")
Dim mySQLcmd As New CoreLab.MySql.MySqlCommand

mySQLcmd.Connection = mySQLcnn

mySQLcmd.CommandText = "select * from urlid limit 1"
For x = 0 To 10000000
TextBox1.Text = x

Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Tue 27 Jun 2006 07:06

We were unable to find any memory leaks using your code snippet.
As you guessed the datareaders wait for the next run of the garbage collector but this is not the source of the memory leak.

Post Reply