Home Web information Comparison of RAM usage on common web browsers

Comparison of RAM usage on common web browsers

0

Web browsers can sometimes consume large amounts of memory, and it’s not uncommon for a browser to use several gigabytes of RAM.

While not a problem for all organizations, high RAM usage can present issues for end users from a compute resource and productivity perspective. IT administrators need to know why memory usage tends to be so high for certain web browsing sessions, how they can measure it, and which browsers use the most memory.

Why do browsers use memory?

Web browsers use memory to cache the various elements that make up a web page. Although browsers still cache objects to disk, as they always have, memory caches are faster than disk caches. Thus, the use of a memory cache considerably improves the performance of a browser.

Also, browsers rarely display static HTML on a page. As such, browsers use memory when performing the various calculations involved in rendering web pages.

Modern browsers are multi-threaded and therefore use multiple system processes. These processes allow parallel instruction execution, improving browser performance. Each of these individual processes consumes memory, which can accumulate quickly.

Measure RAM usage with PowerShell

Measuring the amount of memory consumed by a browser is not as simple as it seems. This is because each browser tab is tied to a separate process and each process has its own memory usage. There may also be processes related to other browser functions running in the background. To measure the overall memory usage of a browser, an administrator must collectively examine all browser processes.

One way for the administrator to gauge the overall memory usage of a browser is to use PowerShell to examine the processes associated with the browser. The three lines of code report memory usage for the Edge browser to show an example of such a PowerShell request:

$A = Get-Process | Where-Object {$_.Name -eq 'MSEdge'}

$B = $A.WS | Measure-Object -Sum
$B.sum /1MB

The first line of code creates a variable named $A and associates this variable with all running processes named MSEdge. Incidentally, the trick to making this code work with other browsers is to replace the process name with the desired browser. If an administrator wants to see the individual processes referenced in the $A variable and the working memory consumed by each process, they can enter the $A | Select object name, WS ordered.

Figure 1. PowerShell can display all individual browser processes and the memory they consume.

This second line of code measures the memory usage of the browser by creating another variable. This variable is called $B and it points to the working set memory usage of the process in question (Figure 1).

The administrator must then direct this information to the Measure-Object cmdlet and add the Sum setting. This adds up the working memory used by each of the MSEdge processes, giving the administrator the total amount of memory the browser is consuming across all open tabs. To find out how many processes the browser is currently using, just enter $B.

The last line of code displays the total working memory consumed by the browser when converting the value to megabytes. Without the /1 MB part of the command, the working game memory will be displayed in kilobytes. As an alternative, administrators could use /1 GB to display memory usage in gigabytes.

Memory usage comparison between browsers

Every browser uses memory in a different way, so administrators can’t really get an idea of ​​a browser’s memory usage by just looking at a single webpage or even a few different webpages.

Despite this, a simple test can illustrate that browsers use memory in different ways and to different degrees. This case study covers Microsoft Edge, Google Chrome, and Mozilla Firefox, all running in a virtual machine. The settings for this test case are a single open browser tab. Administrators should use the PowerShell code listed above to report each browser’s memory usage. The Safari browser was excluded from this test because Apple has not released a PC version of Safari since 2015 and this version is no longer available for download.

Below are the process names associated with each browser in PowerShell.

Browser name Process name
Edge MS Edge
Chromium Chromium
firefox firefox

Google Chrome comes with crash handling processes that are not included in these metrics.

Browser name Browser memory usage
Edge 476.56 MB
Chromium 422.91 MB
firefox 683.66 MB

The results of these test cases should not dictate which browsers an organization prefers or even allow its users to run, but they can provide insight into how browsers consume this resource to inform decision-making (Figures 2 , 3 and 4).

The PowerShell interface showing data related to a Microsoft Edge memory usage survey.
Figure 2. The output of PowerShell code showing memory usage for the Microsoft Edge browser.

There is key context for test cases with Firefox, Chrome, and Edge. First, these tests represent point data. Repeated execution of these tests would likely yield different results.

Another important fact to keep in mind is that when a user closes a browser, the browser’s memory is not necessarily freed. Shortly after closing the Edge browser, this test case found five Edge processes still running on the machine.

The PowerShell interface displaying data related to a Google Chrome memory usage survey.
Figure 3. The output of PowerShell code showing memory usage for the Google Chrome browser.

One last thing to keep in mind is that browser memory usage can increase or fluctuate over time, even if there is no change in end-user actions. The measurements for this exercise were taken immediately after installing the browser. Sometimes browsers consume more and more memory the more they are used, and it can get worse over time.

The PowerShell interface displaying data related to a Mozilla Firefox memory usage survey.
Figure 4. The output of PowerShell code showing memory usage for the Mozilla Firefox browser.

To illustrate this effect, consider an instance of the Edge browser with an open tab on YouTube. Take this action, then close the browser. Repeat this process of opening YouTube several times. A reading of memory usage after repeatedly opening and closing the browser will cause memory to increase, with a sharp increase from the first memory reading to the second (Figure 5).

A PowerShell output showing Microsoft Edge memory readings over a period of time.
Figure 5. Fluctuations in memory usage over time in repeated measurements of Microsoft Edge.

Obviously, browser metrics can vary wildly due to many factors. IT teams should never view individual metrics as the absolute, single reflection of the state of the browser at any given time.