MicrosoftEdge / MicrosoftEdge/WebView2Feedback

Single CoreWebView2Environment object uses more memory than multiple CoreWebView2Environment objects

Open
#1,705 5 comments 0 reactions 1 assignee View on GitHub

@LiangTheDev is already working on this.

Since Sep 10, 2021.

bug tracked
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.