I was looking into the possibility that one of my applications might have a memory leak, so started playing about with some very basic code samples. One I ended up with, when left over time, started to increase greatly in terms of the number of Handles (>3000). It is a very simple Console application with the code as follows:
public static void Main(string[] args)
{
using (SqlConnection sqlConnection = new SqlConnection())
{
}
Console.ReadLine();
}
Taking out the SqlConnection call removes any Handle increase, so I am assuming it has something to do with the connection pool. But as this only runs once before basically going into a wait for input, why would the Handle count keep increasing?
Thanks.
If you are running it on .NET 4.0, this might be the case
https://connect.microsoft.com/VisualStudio/feedback/details/691725/sqlconnection-handle-leak-net-4-0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With