{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Configuration/issues/861","repository_url":"https://api.github.com/repos/aspnet/Configuration","labels_url":"https://api.github.com/repos/aspnet/Configuration/issues/861/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Configuration/issues/861/comments","events_url":"https://api.github.com/repos/aspnet/Configuration/issues/861/events","html_url":"https://github.com/aspnet/Configuration/issues/861","id":343721818,"node_id":"MDU6SXNzdWUzNDM3MjE4MTg=","number":861,"title":"memory leak during the use of reloadOnChange: true with ConfigurationBuilder","user":{"login":"Eilon","id":202643,"node_id":"MDQ6VXNlcjIwMjY0Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/202643?v=4","gravatar_id":"","url":"https://api.github.com/users/Eilon","html_url":"https://github.com/Eilon","followers_url":"https://api.github.com/users/Eilon/followers","following_url":"https://api.github.com/users/Eilon/following{/other_user}","gists_url":"https://api.github.com/users/Eilon/gists{/gist_id}","starred_url":"https://api.github.com/users/Eilon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eilon/subscriptions","organizations_url":"https://api.github.com/users/Eilon/orgs","repos_url":"https://api.github.com/users/Eilon/repos","events_url":"https://api.github.com/users/Eilon/events{/privacy}","received_events_url":"https://api.github.com/users/Eilon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-23T17:18:47Z","updated_at":"2018-07-27T15:41:09Z","closed_at":null,"author_association":"MEMBER","body":"_From @jkotas on July 23, 2018 8:12_\n\n_From @abelpalaty on July 23, 2018 7:39_\r\n\r\n  Hi,\r\nWe have dotnet core driver which connects to our product (CICS TG).\r\nIn the driver we create a connection and closes it after each transaction.\r\nWhile creating the connection we have the following code.\r\n\r\n```c#\r\n     var  builder = new ConfigurationBuilder()\r\n           .SetBasePath(Directory.GetCurrentDirectory())\r\n           .AddJsonFile(\"appsettings.json\", optional: false, reloadOnChange: true);\r\n```\r\n\r\nWith the setting reloadOnChange: true we see the memory leak with time eventhough the connection is closed after each request.\r\n\r\nWe tried with the following code\r\n\r\n```c#\r\n     var  builder = new ConfigurationBuilder()\r\n           .SetBasePath(Directory.GetCurrentDirectory())\r\n           .AddJsonFile(\"appsettings.json\", optional: false, reloadOnChange: false);\r\n```\r\n\r\nwith the setting reloadOnChange: false we see the memory usage is constant with time.\r\n\r\nThe sample we ran runs same application in a loop of like 2500 times where each time new object is created and closed.\r\nOur customer reported this issue and its recreating every time. Its high priority .\r\nIs there any fix available already or is it a known issue?\r\nIs there a way we can make sure memory usage is constant (maybe additional  code to release FileSystemWatcher after the connection is closed.)\r\n\r\nWe created a memory profiling report and we see that the function which allocated the most memory is System.IO.FileSystemWatcher.AllocateBuffer().\r\nI am attaching the screenshots of the observation we did during our testing.\r\n![70910eb8a8b6afd3](https://user-images.githubusercontent.com/41566819/43063074-769bc604-8e78-11e8-8e85-89b2e4abe863.jpg)\r\n![748aa0170f472bc9](https://user-images.githubusercontent.com/41566819/43063075-76d0beb8-8e78-11e8-9892-9bff9e5c5ba8.jpg)\r\n![7e81d48d0df38b32](https://user-images.githubusercontent.com/41566819/43063076-770d7a56-8e78-11e8-8e69-16700d9bddba.jpg)\r\n\r\n\r\n\r\n_Copied from original issue: dotnet/coreclr#19080_\n\n_Copied from original issue: aspnet/Home#3351_"},"comment":{"url":"https://api.github.com/repos/aspnet/Configuration/issues/comments/408457639","html_url":"https://github.com/aspnet/Configuration/issues/861#issuecomment-408457639","issue_url":"https://api.github.com/repos/aspnet/Configuration/issues/861","id":408457639,"node_id":"MDEyOklzc3VlQ29tbWVudDQwODQ1NzYzOQ==","user":{"login":"Eilon","id":202643,"node_id":"MDQ6VXNlcjIwMjY0Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/202643?v=4","gravatar_id":"","url":"https://api.github.com/users/Eilon","html_url":"https://github.com/Eilon","followers_url":"https://api.github.com/users/Eilon/followers","following_url":"https://api.github.com/users/Eilon/following{/other_user}","gists_url":"https://api.github.com/users/Eilon/gists{/gist_id}","starred_url":"https://api.github.com/users/Eilon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eilon/subscriptions","organizations_url":"https://api.github.com/users/Eilon/orgs","repos_url":"https://api.github.com/users/Eilon/repos","events_url":"https://api.github.com/users/Eilon/events{/privacy}","received_events_url":"https://api.github.com/users/Eilon/received_events","type":"User","site_admin":false},"created_at":"2018-07-27T15:41:09Z","updated_at":"2018-07-27T15:41:09Z","author_association":"MEMBER","body":"I wonder if this issue is related to the discussion at https://github.com/aspnet/Home/issues/1976 ..."}}
{"actor":{"display_login":"Eilon"}}