How Microsoft Edge and other applications manage memory
With much of your to-do list now online, you expect your browser to be fast and reliable every day. Your browser is the tool you rely on to get things done. Online productivity now depends on how fast your browser is, so that to-do list can disappear. So, don’t you hate it when your browser slows down and you don’t know why? Suddenly, pages are slow to load, scrolling isn’t smooth and typing takes forever. What you’re seeing is your browser accommodating your tasks, while taking steps to optimize your memory.
For Microsoft Edge, performance is about delivering better speed and responsiveness while reducing the amount of memory your browser uses. This is one of our top priorities – solving this means increasing your productivity so you have more time for the things you enjoy. This paper will walk through how your computer manages memory and what Microsoft Edge is doing to make it better.
How your computer manages memory
Computers have many different types of storage, today we are going to focus on are Random Access Memory, aka RAM, and your hard drive.
RAM is essentially your computer’s short-term memory storage. It temporarily stores data that it’s likely to need again soon. For web browsers, that could be web pages or other resources used by extensions. The main usage of RAM by the browser is to make web pages load faster and to create a smoother browsing experience.
Hard drive is your computer’s long-term memory storage. It can store data permanently. When you power off your device, data stored in your hard drive remains while data in your RAM is erased.
RAM | Hard Drive |
Short term memory storage | Long term memory storage |
Stores data temporarily | Stores data permanently |
Data will erase when device is powered off | Data will remain when device is powered off |
Faster | Slower |
So how do RAM and hard drives’ memory stores get used while you’re browsing the internet?
Let’s say you’ve restarted your computer and the first thing you do is open a shopping site in Microsoft Edge. The data for that site will initially be stored in RAM. If at some point you were to switch tabs and come back to that site or you were to switch applications and come back to the browser, the data on the shopping site can swiftly be recalled from RAM, and the page will load quicker.
Every web page, web app, and extension uses memory and the more complex the web page, web app, or extension, the more memory it will use. That means that with every tab that you open, or extension that you enable, the closer you get to reaching your computer’s max capacity of RAM. When your computer is low in RAM, your computer will move data that you aren’t using from RAM to your hard drive to make space on RAM. Depending on your computer, your hard drive may be an SSD (Solid State Drive) or an HDD (Hard Disk Drive). Retrieving data from either hard drive is often much slower than retrieving data from RAM. However, if we were to compare the two hard drives, retrieving data from an SSD may be tens or hundreds of times faster than an HDD, as an SSD has no moving parts.
Constantly swapping data to and from the hard drive can have a considerable performance impact on the browser and other programs you have open on your device. So, if your system uses your RAM instead – even at nearly 100% usage – this is not a bad thing. This means that you are utilizing nearly all your available RAM to make for a smoother and faster browsing experience.
Looking at memory management through an evening of dinner preparation
It’s a tricky topic, so let’s look at this concept through another lens.
Let’s say, it’s evening and you’re preparing dinner. Tonight, salad is on the menu. Each time you need an ingredient, you open your fridge, grab an ingredient, and add it to your bowl. Adding the ingredient to your salad is easy and can be done quickly because your fridge is easily accessible. This is like data being stored in RAM. When data is stored in RAM, if you return to a webpage, the page can swiftly be recalled, and the page will load quicker.
Let’s say you’re preparing multiple dishes for dinner. After returning from the grocery store, you realize everything doesn’t fit into your fridge. To solve this problem, you decide to move unneeded items from your fridge to your friend’s fridge across town. As you prepare the dishes, you realize that you need an item stored in your friend’s fridge. To make room in your fridge, you grab an item you aren’t using, drive across town to your friend’s, and grab the item you need from their fridge while leaving the item you brought. You then return home and put the retrieved item in your own fridge to use. You continue cooking but later realize you need another item that is at your friend’s house. Once again, you drive over with another item from your fridge to swap. As you can see, it takes longer for the items that are not in your fridge to be retrieved and used. Running out of fridge space is like running out of RAM. When you run out of RAM, data that’s not being used gets stored in your hard drive and retrieving data from the hard drive is often much slower.
Finally, let’s revisit the previous example but this time your fridge is double the size. Double the size, means that you can store all the ingredients in your fridge (and not rely on your friend’s fridge). Similar, to the first example, in this scenario all the ingredients are easily accessible and can be quickly added to the dish. This is comparable to you having double the RAM. All the data can be stored in RAM and accessed quickly when necessary.
Using RAM is a good thing because it creates a fast and smooth browsing experience. However, when your RAM reaches capacity and you start reading data from your hard drive, that’s when your browsing experience is likely to change. We are aware that this can lead to a negative browsing experience, so Microsoft Edge tries to keep you from reaching that max capacity.
To start, Microsoft Edge is actively taking steps to reduce the browser’s overall resource usage. To keep your system using RAM when it is running low, and before things are moved to disk, Microsoft Edge will discard tabs that haven’t been used in a while. Discarding a tab’s resources frees up RAM on your computer for other things, like the tab you’re currently using and other applications or processes running on your device. You can still see discarded tabs in the tab strip even though all resources are released and processes killed. When you return to the tab, the processes will be recreated, the tab will reload, and page elements such as scroll position and form content will be restored but the overall experience may be slower than normal. Tab discard is implemented because it is sometimes faster for a discarded tab to be reloaded than trying to fetch individual pieces of data from the hard drive, similar to how it would be faster to go to the grocery store nearby for a new ingredient, than to drive across the city to your friend’s house to retrieve the ingredient.
Listening to your feedback
We want browsing the web to be effortless. We continue to look for ways to improve the experience around browser resource usage. You can find more information on the improvements currently available here. We also recently released a new feature to the Canary and Dev channels called sleeping tabs, which puts inactive tabs to sleep after 2 hours of inactivity to free up resources for other areas, such as active tabs, new tabs, and other applications on your device. A sleeping tab resumes automatically when clicked, which is different than discarded tabs, which require the page to fully be reloaded.
If you experience an issue with Microsoft Edge, send us feedback with as much detail as possible. Please include information such as steps to reproduce the issue, the URL of the page you visited, diagnostic data, a screenshot, and your email address, so we can email you for more information. This will help us address your feedback.
Stay tuned for an upcoming blog post where we’ll learn how to investigate Microsoft Edge’s memory usage.
– Allison Pastewka, Program Manager, Microsoft Edge
Source: How Microsoft Edge and other applications manage memory