Skip to content

Single CoreWebView2Environment object uses more memory than multiple CoreWebView2Environment objects #1705

Open
@JaseRandall

Description

@JaseRandall

I'm clearly wrong here but I was expecting a single instance of CoreWebView2Environment shared across multiple WebView2 instances would use less memory however I've found the opposite. eg 200mb when CoreWebView2Environment shared across four instances of WebView2 vs 150mb when four instances of WebView2 each create their own CoreWebView2Environment.

The documentation: https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2environment?view=webview2-dotnet-1.0.902.49 doesn't give any great insight into what's going on.

Can you please advise if it's preferable/beneficial to use a single CoreWebView2Environment shared across all WebView2 instances in my code or should I save memory and just let WebView create a new CoreWebView2Environment automatically every time I create a new WebView2 object?
Or at least, can you please point me to somewhere where I can learn myself?

Thanks in advance.
P.S. Thanks also for the work your doing on this new control.

AB#35958409

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtrackedWe are tracking this work internally.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions