CefSharp icon indicating copy to clipboard operation
CefSharp copied to clipboard

Memory Issues managing multiple WPF WebViews

Open jasonds opened this issue 13 years ago • 4 comments

I noticed memory not being reclaimed when opening and closing multiple WebView instances in WPF.

The application is wrapped with CEF.Initialize and Shutdown.

I give the ability to open multiple WebViews each with a different address and close them at will. Calling dispose is hit or miss, resulting sometimes in a C++ runtime error - "pure virtual function call," or in issues with the runtime callable wrapper.

I've read through other issues and saw that most people only handle one WebView. Does anyone have any good examples of handling multiple WebViews in WPF?

jasonds avatar Oct 02 '13 17:10 jasonds

I have experienced similar issues. I think the "right" answer is to call Dispose() every time you ditch a WebView. However, as you say, this often causes exceptions, especially on subsequent JavaScript interop calls. Right now I'm just trying to limit the number of times I need to dispose a WebView (make them singleton and re-use as often as possible), but I too would like to see a solution for this.

dcartwright avatar Oct 08 '13 14:10 dcartwright

If this issue is still nagging you then have a look at the #249 Pull Request. It would be great to know if it resolves the issue you guys see or not.

jornh avatar Feb 23 '14 14:02 jornh

@jasonds can u try again with the current master i did some dispose work

JanEggers avatar May 30 '14 10:05 JanEggers

Please upgrade to CefSharp3 if there's still a problem. If you experience issues with the latest release please create a new issue :smile:

amaitland avatar Oct 13 '14 02:10 amaitland