Google announced that Chrome 55, which should come out on December 6, will significantly improve RAM usage for Chrome processes. The company said that on average, the memory footprint of the tested websites dropped by half.
Chrome’s Memory Bloat Issue
Google’s Chrome has long been criticized for using too much memory compared to other browsers. This can lead to not just lower available resources on a user’s device, but also lower battery life.
At first glance, the significantly higher memory usage seemed to have been caused by Google’s sandboxing architecture, which separates each tab and extension into their own operating system processes.
This sandboxing mechanism significantly increases security, because websites use their own isolated resources, instead of sharing them with other websites, the way Firefox’s new sandboxing architecture works. However, it also means there would be some redundancy, which can add up to a couple of gigabytes of RAM when you have multiple tabs open and many installed extensions.
Reduced V8 Heap Size
However, it seems the reduction in heap size comes with a trade off in garbage collection latency. When there is less memory to be used, the garbage collection needs to be invoked more frequently, which can lead to user-visible “jank” on websites. On devices with under 512MB of RAM, it can also lead to crashes.
The Google engineers chose to enable a “memory reduction mode” only when necessary. Therefore, the mode will be enabled only when there isn’t too much memory available, when there are many other apps open, or when Chrome has too many open tabs. Due to this optimization, the Chrome team saw an average of 50% memory reduction across a handful of tested websites, while using Chrome 55 compared to the current Chrome 53 version.
Another major improvement that the Google engineers added to the V8 engine is the faster removal of parsed scripts from memory, after they’re no longer in use. This also resulted in reduced average and peak memory usage.
Previously, Google allowed the compiler to pack fields in the abstract syntax tree nodes generated by the parser. For instance, two boolean values require only two bits, and they should be packed within one word or within an unused fraction of the previous word. However, the compiler doesn’t always find the most compressed packing, so the Chrome team manually packs the bits. This results in lower memory usage, as well as better parser and compiler performance.
The Chrome team intends to keep working on improving memory footprint of the V8 engine with more memory optimizations planned for the parser and a focus on devices with 512MB to 1GB of RAM.