Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Higher RAM usage in NETCore #4716

Open
1 task done
Schnutzel opened this issue Feb 12, 2024 · 1 comment
Open
1 task done

Higher RAM usage in NETCore #4716

Schnutzel opened this issue Feb 12, 2024 · 1 comment

Comments

@Schnutzel
Copy link

Schnutzel commented Feb 12, 2024

Is there an existing issue for this?

  • I have searched both open/closed issues, no issue already exists.

CefSharp Version

120.2.50

Operating System

Windows 11

Architecture

x86

.Net Version

.NET 6.0

Implementation

WinForms

Reproduction Steps

Create minimal application that uses CefSharp and build it both for .NET Framework and .NET Core.

Expected behavior

Both versions should take a similar amount of RAM.

Actual behavior

There's a 20-30% difference between the two versions' working set.

See this table (taken from Process Explorer):

.NET 6:

Process name Private Bytes Working Set
Chromium.exe 37,292 K 99,908 K
CefSharp.BrowserSubprocess.exe 101,244 K 85,808 K
CefSharp.BrowserSubprocess.exe 21,888 K 34,820 K
CefSharp.BrowserSubprocess.exe 23,264 K 42,092 K
CefSharp.BrowserSubprocess.exe 25,764 K 43,848 K
CefSharp.BrowserSubprocess.exe 28,040 K 58,440 K

.NET 4.7.2:

Process name Private Bytes Working Set
Chromium.exe 35,532 K 80,800 K
CefSharp.BrowserSubprocess.exe 103,972 K 75,220 K
CefSharp.BrowserSubprocess.exe 21,380 K 32,504 K
CefSharp.BrowserSubprocess.exe 20,404 K 25,964 K
CefSharp.BrowserSubprocess.exe 24,264 K 34,704 K
CefSharp.BrowserSubprocess.exe 26,220 K 48,696 K

This increases even further when I actually start browsing in either program.

Regression?

No response

Known Workarounds

No response

Does this problem also occur in the CEF Sample Application

Not Tested

Other information

No response

@amaitland
Copy link
Member

The code is nearly identical, the major differences being the compiler and the runtime. We're still building using .Net Core 3.1.

There are some differences I've observed between the .Net Framework builds vs the .Net Core builds, for example opening CefSharp.Core.Runtime.dll in dotPeek you can see the referenced dlls in the .Net Core version contains every dll in the runtime, where the .net framework version only has the used references. So I think the compiler isn't behaving correctly there.

Once #4640 has been resolved we can look at upgrading to a new .Net version.

In the short term you can try self hosting the browser sub process so the BrowserSubProcess runs the same version of .net as your main application.

https://github.com/cefsharp/CefSharp/wiki/SelfHost-BrowserSubProcess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants