MicrosoftEdge / WebView2Samples

Microsoft Edge WebView2 samples
830 stars 460 forks source link

Dispose of unnecessary WebView2 resources when navigating between pages in the WebView2 UWP sample app. #179

Closed pieths-ms closed 1 year ago

pieths-ms commented 1 year ago

In the WebView2 UWP sample app, when navigating between pages, the garbage collector takes a long time to activate and does not remove WebView2 resources in a reasonable amount of time. This leaves behind all the render processes and other resources which can bog down low memory systems. This PR "closes" all WebView controls which are on a page that is being unloaded and thus releases all significant resources which are used by those controls.