简体   繁体   中英

CefSharp (chromium) javascript increase memory limit

I have a web app that utilizes a lot of memory by displaying huge data reports. The app gets the minimal information it needs from an ajax call to a php script, and then processes everything and saves in memory.

Some reports are so large that the browser crashes before even reaching the PC's memory limit (5GB/8GB free)... So I made a browser app with C# CefSharp and I am looking for ways to increase the memory size so it doesn't crash.

I tried minimizing the data the best I can and using references everywhere I can (there are no duplicate values), and the whole report has to be in memory so the users can properly search and navigate. The reports are coming by date ranges of up to 3 months so it's not like I'm giving them all-time reports.

I've seen some threads telling I should increase the jsHeapSize by passing args and things like that, but I'm not sure how to do so and if it will work.

How can I increase the memory limit in my CefSharp component?

Thank you.

Alright guys, I've come up with a solution for this.

When you pass these arguments to the chrome executable to set the javascript memory limit to 16GB, chrome will set it to 3.5GB.

--js-flags="--max_old_space_size=16384"

It seems that setting the memory size to anything above 3.5 GB will result in Chrome setting it to 3.5GB, thus not allowing the limit to be higher.

However, in CefSharp (chromium embedded), this limit does not exist. With this code:

CefSettings settings = new CefSettings();
settings.CefCommandLineArgs.Add("--js-flags", "--max_old_space_size=16384");

I can set the maximum memory limit of the CefSharp component to 16gb, and it won't crash anymore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM