Virtual memory is a feature of an operating system that uses hardware and software to compensate for shortages of physical memory. It transfers pages of data from random access memory (RAM) to disk storage. Microsoft compares this process to how a “movie ticket serves as a controlling agent between the demand and the seats in a theatre”. It’s a process that is available on Windows, MacOS, Android and iOS.

3d rendering of human  brain on technology background
Virtual memory can compensate for the shortfalls of physical memory (Getty / iStock)

How does virtual memory work?

Virtual memory works through a temporary process, known as swapping, that combines RAM and with space on the hard disk. On a PC, RAM is the physical memory is where operating system data, running programs and open documents are held. When RAM runs low, virtual memory can move data from the RAM to a space called a paging file. This process allows for RAM to be freed up so that a computer can complete the task.

Occasionally a user might be shown a message that says the virtual memory is running low. This means that either more RAM needs to be added, or the size of the paging file needs to be increased. Typically, operating systems such as Windows will manage this process automatically. It can also be changed manually if the default size of the virtual memory isn’t large enough.

Why is virtual memory needed?

RAM data can change at any time. For example, a user might only have one program or one document open, sometimes they might have numerous programs and documents open. The more RAM a device has, the more data and programs it can run at the same time.

There will be times that a device has too many programs open and not enough RAM to run them. Transferring data from the RAM to the hard disk frees up RAM; this data isn’t being used at the time.

However, using virtual memory means the device will run slower than if it was using RAM. This is because the processor has to wait while the data is being swapped between the RAM and the hard disk. Secondary storage devices, such as a hard disk, have slower access times and can impair the device’s processing time.

This can be avoided if the size of the RAM is increased.

How to increase virtual memory

The settings for managing and increasing virtual memory are different depending on which operating system you use.

For Windows, you can manage your memory processing in the “settings” panel; type “performance” in the search bar and select “adjust appearance and processing of windows.” You then click on the “advanced” tab and under “virtual memory”, you can click on change. Clear the automatically manage paging file size for all drivers and check box.

Under drive (volume label) click the drive that contains the paging file to change, click custom size and type in a new size in megabytes, click set, then ok.

On Apple devices running MacOS, you need to ensure the program you want to use the virtual memory for is closed. From the “file” menu, select “get info” and then “memory”. In newer versions of MacOS, the operating system uses virtual memory how it deems it should be used. In MacOS, virtual memory data is also encrypted so it remains secure when it’s swapped between the hard disk and the RAM.

On devices running Android, the mobile operating system from Google, a memory card will need to be used to increase virtual memory.

Read more: IE11 end-of-life: How will it affect businesses and developers?