List:MySQL and .NET« Previous MessageNext Message »
From:Barry Zubel Date:May 7 2008 2:56pm
Subject:Mysql Connector - Is this a real memory leak?
View as plain text  
I'm currently tracing a memory leak in our application and would like to 
discount / ignore the MySqlConnector/Net.

However, using memprofiler throws up some apparent memory leaks which 
don't seem to make any sense and I wondered if someone could shed some 
light on them.

I ran the following code through memprofiler:

        Using conn As New MySqlConnection("<your connection string>")
            Using comm As New MySqlCommand("<an SQL statement that 
returns a datatable>", conn)
                Using da As New MySqlDataAdapter(comm)
                    Using dt As New DataTable
                    End Using
                End Using
            End Using
        End Using

All fairly simple and above board.   Memprofiler unfortunately thinks 
there is a problem, consisting of 60 Undisposed DataColumn objects that 
were created here:

DataColumnMapping.GetDataColumnBySchemaAction(string, string, DataTable, 
Type, MissingSchemaAction)
string, Type, DataTable, MissingMappingAction, MissingSchemaAction)
DataTableMapping.GetDataColumn(string, Type, DataTable, 
MissingMappingAction, MissingSchemaAction)
MissingSchemaAction, bool, DataColumn, object)
SchemaMapping..ctor(DataAdapter, DataSet, DataTable, 
DataReaderContainer, bool, SchemaType, string, bool, DataColumn, object)
DataAdapter.FillMappingInternal(DataSet, DataTable, string, 
DataReaderContainer, int, DataColumn, object)
DataAdapter.FillMapping(DataSet, DataTable, string, DataReaderContainer, 
int, DataColumn, object)
DataAdapter.FillFromReader(DataSet, DataTable, string, 
DataReaderContainer, int, int, DataColumn, object)
DataAdapter.Fill(DataTable[], IDataReader, int, int)
DbDataAdapter.FillInternal(DataSet, DataTable[], int, int, string, 
IDbCommand, CommandBehavior)
DbDataAdapter.Fill(DataTable[], int, int, IDbCommand, CommandBehavior)
Form1.Button4_Click(object, EventArgs)

Are these genuinely pinned in memory, or are they simply being cached 
for later GC collection?


Mysql Connector - Is this a real memory leak?Barry Zubel7 May