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>")
conn.Open()
Using comm As New MySqlCommand("<an SQL statement that
returns a datatable>", conn)
Using da As New MySqlDataAdapter(comm)
Using dt As New DataTable
da.Fill(dt)
End Using
End Using
End Using
conn.Close()
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)
DataColumnMappingCollection.GetDataColumn(DataColumnMappingCollection,
string, Type, DataTable, MissingMappingAction, MissingSchemaAction)
DataTableMapping.GetDataColumn(string, Type, DataTable,
MissingMappingAction, MissingSchemaAction)
SchemaMapping.SetupSchemaWithoutKeyInfo(MissingMappingAction,
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)
DbDataAdapter.Fill(DataTable)
Form1.Button4_Click(object, EventArgs)
Are these genuinely pinned in memory, or are they simply being cached
for later GC collection?
B.
Thread |
---|
• Mysql Connector - Is this a real memory leak? | Barry Zubel | 7 May |