{"action":"created","issue":{"url":"https://api.github.com/repos/cefsharp/CefSharp/issues/984","labels_url":"https://api.github.com/repos/cefsharp/CefSharp/issues/984/labels{/name}","comments_url":"https://api.github.com/repos/cefsharp/CefSharp/issues/984/comments","events_url":"https://api.github.com/repos/cefsharp/CefSharp/issues/984/events","html_url":"https://github.com/cefsharp/CefSharp/issues/984","id":71563708,"number":984,"title":"Undisposed instances of BrowserProcessServiceHost","user":{"login":"deepthireddyb","id":12151827,"avatar_url":"https://avatars.githubusercontent.com/u/12151827?v=3","gravatar_id":"","url":"https://api.github.com/users/deepthireddyb","html_url":"https://github.com/deepthireddyb","followers_url":"https://api.github.com/users/deepthireddyb/followers","following_url":"https://api.github.com/users/deepthireddyb/following{/other_user}","gists_url":"https://api.github.com/users/deepthireddyb/gists{/gist_id}","starred_url":"https://api.github.com/users/deepthireddyb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deepthireddyb/subscriptions","organizations_url":"https://api.github.com/users/deepthireddyb/orgs","repos_url":"https://api.github.com/users/deepthireddyb/repos","events_url":"https://api.github.com/users/deepthireddyb/events{/privacy}","received_events_url":"https://api.github.com/users/deepthireddyb/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cefsharp/CefSharp/labels/wpf","name":"wpf","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-04-28T11:34:34Z","updated_at":"2015-04-28T20:47:03Z","closed_at":null,"body":"We are in the process of memory profiling our application once integration is completed with Cefsharp projects. Our application performance is getting poor when it ran for 2 or 3 hours continuously. So we used .Net memory profiler tool to understand the situation where memory leaks are happening. \r\n\r\nThis tool found few issues with BrowserProcessServiceHost which is not getting disposed and left lot of instances in memory. \r\n\r\n![browserprocessservicehost_undisposed](https://cloud.githubusercontent.com/assets/12151827/7368273/0c955a5c-edc4-11e4-97de-26ac4b839168.jpg)\r\n\r\nSeems like ManagedCefBrowserAdapter.h implemented dispose just for closing browser process service host instance created but did not dispose the host instance. Hence I thought of implementing a possible fix which is adding IDisposable for BrowserProcessServiceHost and a dispose for host instance. \r\n\r\nAfter running profiler again, warning was gone in results but the value Delta (HeapMemory: 624) is increased which means there is still leak in memory. \r\n\r\nI am looking for fixes in v39 version especially if there are any memory leaks and also I may need few suggestions on fixing memory leaks in cefsharp projects. \r\n\r\nCefSharp version downloaded: v39 CEF 3.2\r\nIntegrated with WPF project.\r\n\r\nThanks in advance!!"},"comment":{"url":"https://api.github.com/repos/cefsharp/CefSharp/issues/comments/97202627","html_url":"https://github.com/cefsharp/CefSharp/issues/984#issuecomment-97202627","issue_url":"https://api.github.com/repos/cefsharp/CefSharp/issues/984","id":97202627,"user":{"login":"amaitland","id":307872,"avatar_url":"https://avatars.githubusercontent.com/u/307872?v=3","gravatar_id":"","url":"https://api.github.com/users/amaitland","html_url":"https://github.com/amaitland","followers_url":"https://api.github.com/users/amaitland/followers","following_url":"https://api.github.com/users/amaitland/following{/other_user}","gists_url":"https://api.github.com/users/amaitland/gists{/gist_id}","starred_url":"https://api.github.com/users/amaitland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amaitland/subscriptions","organizations_url":"https://api.github.com/users/amaitland/orgs","repos_url":"https://api.github.com/users/amaitland/repos","events_url":"https://api.github.com/users/amaitland/events{/privacy}","received_events_url":"https://api.github.com/users/amaitland/received_events","type":"User","site_admin":false},"created_at":"2015-04-28T20:47:03Z","updated_at":"2015-04-28T20:47:03Z","body":"> Oh, ick. Regardless of BrowserServiceHost instances not being disposed, you should cache created browser instances, given that any HTML browser is the opposite of small and lightweight.\r\n\r\nIndeed! There's a massive overhead for spawning even a single instance. Better just to keep reference and hide the instance. When the `ChromiumWebBrowser` is hidden it'll stop rendering to save resources.\r\n\r\n@deepthireddyb If the example you provided is enough to reproduce the problem, then I'd suggest modifying the `CefSharp.WPF.Example` project so you can debug, step through the dispose methods, make sure they're being called."}}