question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:20 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
bgraingercommented, Jun 20, 2017

I opened #275 to track SslStream not being disposed.

0reactions
UnoSDcommented, Jan 4, 2018

Apologise if I wasn’t able to cut some time to test, I will send some updates if we get back to it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Memory leak
In computer science, a memory leak is a type of resource leak that occurs when a computer program incorrectly manages memory allocations in...
Read more >
What is Memory Leak? How can we avoid?
Memory leak occurs when programmers create a memory in a heap and forget to delete it. The consequence of the memory leak is...
Read more >
What Is a Memory Leak and How Do They Happen?
A memory leak is a portion of an application that uses memory from RAM without finally freeing it. The result is that an...
Read more >
Memory leak
Memory is allocated but never freed. Memory leaks have two common and sometimes overlapping causes: Error conditions and other exceptional circumstances.
Read more >
Three kinds of memory leaks - Made of Bugs - Nelson Elhage
Type (1): Unreachable allocations ︎. This is the classic C/C++ memory leak. Someone allocated memory with new or malloc , and never called ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found