MySqlConnector: Memory leak bug

The following code causes a memory leak on Linux:

using (var connection = new MySqlConnection(_connectionString))
{
    await connection.OpenAsync();

    using (var transaction = connection.BeginTransaction())
    using (var command = new MySqlCommand(connection, transaction))
    {
        command.CommandText = "SOMESQL";
        command.ExecuteNonQuery();

        command.CommandText = "SOME OTHER SQL";
        command.ExecuteScalar();

        transaction.Commit();
    }
}

I couldn’t investigate it further, but lldb with the SOS plugin shows System.String containing the queries accumulating in the heap.

Please let me know if you would like some more details.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 20 (9 by maintainers)

Most upvoted comments

I opened #275 to track SslStream not being disposed.