1

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.

FightRay
  • 144
  • 14
  • @vasily.sib - Maybe chrome shouldn't limit developers to only 2GB of memory when the user has another 3GB RAM to spare? My Chromium C# app crashes when it gets to 5GB out of 8GB memory.... that is absolutely ridiculous. There must be a way to increase the memory limit in CefSharp. – FightRay Mar 11 '19 at 10:14
  • @vasily.sib I'd understand if they made the system crash the app if there's only like 500MB or 1GB RAM to spare, but I have 3GB to spare and I NEED to see the whole report. Our users will decide if they want to use the app or not, there has to be a way to increase the memory size. If you can't answer the question, please stop being rude and go do something useful. – FightRay Mar 11 '19 at 10:23
  • I didn’t want to be rude, sorry. And I can't answer this question (that's why I writing comments and not answer). [There is another question](https://stackoverflow.com/questions/7193959/memory-limit-in-node-js-and-chrome-v8) about V8 (Crome JS Engine) memory limit, may be this can help. Actually, I think this question can't be answered and you should find another way to do this. – vasily.sib Mar 11 '19 at 10:32
  • Are you using a 64bit process? You'll be limited to 2gb for 32bit, 3gb with large address aware. If it doesn't work in Chrome then you won't have any better luck with CefSharp. – amaitland Mar 11 '19 at 10:55
  • @amaitland - Yeah I'm using 64bit Chrome though. Same with CefSharp. But perhaps it's worth trying the large address away arg. How do I pass it? – FightRay Mar 11 '19 at 11:08
  • It's only valid for 32bit processes – amaitland Mar 11 '19 at 11:20

1 Answers1

1

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.

FightRay
  • 144
  • 14