Number of C # Handlers

I was exploring the possibility that one of my applications might have a memory leak, so I started playing with some very basic code samples. One of them, which I ended up with, has significantly increased over time in terms of the number of pens (> 3000). This is a very simple console application with code as follows:

public static void Main(string[] args) { using (SqlConnection sqlConnection = new SqlConnection()) { } Console.ReadLine(); } 

The output of the SqlConnection call eliminates any increase in Handle, so I assume it has something to do with the connection pool. But since it only starts once before basically going to wait for input, why does the handle counter keep increasing?

Thanks.

+6
source share
2 answers

You will find that most of the object cache consists of infrastructure objects, such as those created in such a way that you can access configuration files and resources without having to manually analyze the files manually.

IIRC object cache by default - about 4000 objects.

you should remember that just because your only creation and deletion of one object does not mean that all work with the frame is performed

0
source

Source: https://habr.com/ru/post/983586/


All Articles