Open Juandavi1 opened 8 months ago
Hi @DavoudEshtehari and @Juandavi1
In this PR, some memory leaks have been fixed. https://github.com/dotnet/SqlClient/pull/2420
Thank you for proposing the PR. We'll look into it.
Hi ! We found something. We are calling SqlConnection.ClearPool() after each query and the memory leak disappear. However the performance increase a lot !
I was wondering 🤔 Is there a way to have the same pool for diferente connections? Do you know? @DavoudEshtehari
If we set pooling to false, throws a too many noon-pooled connections exception
Describe the bug
Hi !
We have a multi-tenant db model. Each user has a different connection string.
We have a base class that creates the connections and data accessors.
Something like this:
Further technical details
Microsoft.Data.SqlClient version: 5.2.0 .NET target: net 6 SQL Server version: Azure sql database Level compatibility 160 Version 16 Operating system: Docker
Additional context
We've already conducted tests with pooling set to both true and false, and the problem persists.
Our connection string looks like this:
At night, when traffic is zero, the memory does not decrease. We also tried calling the garbage collector (GC) manually, and the memory decreased by a few MB.