How to control memory usage in Vivaldi

How does Vivaldi handle memory usage and what can you do to reduce it? Here are a few tips that should make your browsing faster.

Screen with javascript code.

We often get questions about how Vivaldi handles memory usage and our recommendations for reducing it, so we thought a blog post was due. But before looking at what you can do to reduce memory usage, let’s dive into how Vivaldi uses memory.

The multi-process model

In most modern operating systems, each application gets allocated a separate process. A process can be defined as an instance of a computer program that is being executed. This architectural decision makes sure that a crash of a single application doesn’t stop other applications, or an operating system as a whole, from working properly. Imagine if your music player bugged out and crashed and suddenly all the other running apps shut down as well, including your spreadsheets, text editor and so on. That would be kind of annoying. Luckily, this won’t happen in modern operating systems as each process is enclosed and isolated from others. This same design decision is part of Chromium – an open source browser engine that Vivaldi is built with. This design is called a multi-process model.

Bigger websites mean bigger processes

In the early days of the Web, websites were much simpler, and it made sense for the browser to render all the pages you visited in the same process. These days, the average size of websites has grown drastically. Based on statistics provided by httparchive.org, the average web page size in 2017 is 2959 kb, compared to only 702 kb back in 2010. 

Average bytes per page per content type.

A viable solution is to keep these apps separate from each other, just like we do in operating systems. If a website has a buggy or malicious code, it won’t affect the other tabs or the browser as a whole. A trade-off is that while this increases stability, it also increases memory overhead. Some browser engines have opted for a different approach where data and resources are shared between tabs and extensions (single-process model). Whilst this may reduce memory usage, it can potentially cause a browser-wide crash if a single website or extension misbehaves.

So when you open a new tab it will correspond to a new separate process in the browser. Got five tabs running while using two extensions? Your browser is probably using somewhere around nine different processes (platform dependent). Five for the tabs, two for the extensions, one for the GPU process and one for the browser itself. As you can see, there are different types of processes. We can split these into four different categories:

  • The browser process. This process handles the user interface, along with disk and network I/O and all the other processes run on top of it.  A new browser process is created when Vivaldi starts up and only one browser process is created.
  • Renderer processes. These handle the rendering in individual browser tabs, such as handling HTML, CSS, JavaScript and so on. As mentioned previously, a new renderer process is created for each website when you open in a new tab. If you type the URL of a different site into the address bar, Chromium will swap the old renderer process with a new one for the tab. Several renderer processes may, therefore, be active at the same time, but a new tab doesn’t always spawn a new process.
  • Plugin processes. Each browser plugin, like Adobe Flash, runs in its own separate process. There is one process instance for each type of active plugins. For example, all Flash instances run in the same process, even if they appear in different sites or tabs. If you close all the pages using a particular plugin, its process will be destroyed after a short amount of time.
  • Extension processes. Extensions, like ad blockers or password managers, also get their own separate processes.

Having these separate processes increases the reliability and security of the browser, which is one of the key benefits of the multi-process model. Chromium’s renderer processes are executed within a sandboxed process that has limited access to the user’s computer. Just like in a real sandbox, it’s designed to build a restrictive environment around each process. For example, if you open a web page containing malicious code that’s made to harm your computer, the sandbox will prevent further damage to other tabs, the browser as such or the rest of your computer. These processes only have access to a limited set of resources, accessed only through the browser process.

How to reduce memory usage

Use task manager regularly 

A benefit of the multi-process model is that you are in control of the browser’s memory usage. If you take a look at your menu bar and go to Tools -> Task Manager, you’ll get access to all active processes in Vivaldi and their individual memory usage. Here, you can spot memory hogging web apps, whether it’s due to heavy resource requirements or a possible memory leak (if a site is using progressively more memory, then you’ve got a leak). Simply select a tab or extension from the task manager and then select End process to kill it. You’ll still see the tab in the tab bar, but if you open it, you’ll see a black screen indicating that the tab (or process) is no longer active.

Hibernate tabs to free resources 

Vivaldi supports manual hibernation for both individual tabs and for Tab Stacks, which allows you to specify which tabs you want to free resources on. Just right-click a tab or Tab Stack and select Hibernate Tab (link) / Hibernate Tab Stack. What happens here is that the browser will discard the tab, destroy its web contents and replace it with an “empty” tab. Whenever you revisit the hibernated tab, you’ll notice that the page will refresh as the empty tab reloads the page. Overall, this will reduce the browser’s memory footprint. If you are, for instance, researching a topic and end up with dozens of tabs that you don’t necessarily need right away, it might be a good idea to stack them into a group and then hibernate the whole stack. They will still be readily available when needed, but won’t use as many resources as your other active tabs.  

Pay attention to extensions and plugins

Because Vivaldi is built on Chromium, extensions available in the Chrome Web Store can also be installed in Vivaldi. If you have many installed, they will accumulate quite a bit of memory. You may want to go through them to find out if you can get rid of some that you are not using anymore, or not often.

Instead of uninstalling them outright, try disabling them first. You can do this by going to Vivaldi Menu -> Tools -> Extensions. Find the extension you want to turn off and uncheck the box next to “Enabled”. If you really want to cut down on memory, you can also disable certain built-in plugins to reduce the number of active processes. By default, the Flash plugin is turned off but whenever the browser sees Flash content it will let you turn it on temporarily.

Prompt to disable an extension.

Not many users are aware of how browsing behavior and customizations can impact memory usage. So next time you see someone with dozens of unused extensions, pass on a few tips on how they can reduce their memory usage.

Happy browsing!

comments