Increasing javascript heap size limit

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Increasing javascript heap size limit

Postby dem219 » Tue Apr 19, 2016 12:56 pm

We have found that at times our application's memory spikes, and seems to exceed the javascript heap size limit in a 32 bit x86 application (~800mb). When the application exceeds this limit the render process crashes.

I have found that I can increase this size with the --js-flag of --max-old-space-size=2000. This seems to increase it up to approximately ~1.5 gigs (it seems to max out there, no matter what is passed).

We will continue to pursue this excessive memory growth. But I wanted to know if there was any known downside (in terms or performance, stability, or otherwise) of increasing this limit?

Thanks
dem219
Newbie
 
Posts: 9
Joined: Mon May 06, 2013 8:44 am

Re: Increasing javascript heap size limit

Postby amaitland » Tue Apr 19, 2016 4:00 pm

Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Re: Increasing javascript heap size limit

Postby amaitland » Tue Apr 19, 2016 4:01 pm

dem219 wrote:I have found that I can increase this size with the --js-flag of --max-old-space-size=2000.


Do you have a reference? Could be useful for others, thanks!
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Re: Increasing javascript heap size limit

Postby dem219 » Wed Apr 20, 2016 11:03 am

I found comments about increasing the heap size limit in a few forums, for example here:
https://bugs.chromium.org/p/v8/issues/detail?id=847#c28

You can verify the change by looking at
performance.memory.jsHeapSizeLimit in the console after setting the flag

A few things I did notice
1. Setting the size larger than 2000 caused my CefSharp application to crash soon after start-up
2. No matter how high the limit is set, the effective heap size limit seems to be ~1.5 gigs (I found another comment in a different forum to that effect, and have verified it in testing).
3. The same limits and behavior is found on 64bit and 32bit builds

I did find one downside in setting the limit very high. This is based on observation, and I have not verified it definitively yet. It seems as though the limit effects when v8 runs a GC. So by setting the limit higher, garbage collects longer. If the limit is set above 1.5 gigs, to 2000 for example. GC does not kick in reliably before the 1.5 limit - this cause the application to crash frequently. By setting the limit at 1400, the application seemed to GC appropriately and remained more stable.
dem219
Newbie
 
Posts: 9
Joined: Mon May 06, 2013 8:44 am

Re: Increasing javascript heap size limit

Postby amaitland » Wed Apr 20, 2016 3:28 pm

dem219 wrote:I found comments about increasing the heap size limit in a few forums, for example here:
https://bugs.chromium.org/p/v8/issues/detail?id=847#c28

You can verify the change by looking at
performance.memory.jsHeapSizeLimit in the console after setting the flag


Thanks!
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am


Return to Support Forum

Who is online

Users browsing this forum: Majestic-12 [Bot] and 100 guests