Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

memory leak during the use of reloadOnChange: true with ConfigurationBuilder #861

@Eilon

Description

@Eilon

From @jkotas on July 23, 2018 8:12

From @abelpalaty on July 23, 2018 7:39

Hi,
We have dotnet core driver which connects to our product (CICS TG).
In the driver we create a connection and closes it after each transaction.
While creating the connection we have the following code.

     var  builder = new ConfigurationBuilder()
           .SetBasePath(Directory.GetCurrentDirectory())
           .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);

With the setting reloadOnChange: true we see the memory leak with time eventhough the connection is closed after each request.

We tried with the following code

     var  builder = new ConfigurationBuilder()
           .SetBasePath(Directory.GetCurrentDirectory())
           .AddJsonFile("appsettings.json", optional: false, reloadOnChange: false);

with the setting reloadOnChange: false we see the memory usage is constant with time.

The sample we ran runs same application in a loop of like 2500 times where each time new object is created and closed.
Our customer reported this issue and its recreating every time. Its high priority .
Is there any fix available already or is it a known issue?
Is there a way we can make sure memory usage is constant (maybe additional code to release FileSystemWatcher after the connection is closed.)

We created a memory profiling report and we see that the function which allocated the most memory is System.IO.FileSystemWatcher.AllocateBuffer().
I am attaching the screenshots of the observation we did during our testing.
70910eb8a8b6afd3
748aa0170f472bc9
7e81d48d0df38b32

Copied from original issue: dotnet/coreclr#19080

Copied from original issue: dotnet/aspnetcore#3351

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions