Virtual memory is a key element of computer-memory management. But what is it, exactly?

The smooth operation of a computer depends on many factors. To access data and provide it to users, it relies on several critical components. Among these is virtual memory, a crucial element in ensuring the seamless performance and processing for any computer during routine operations.

Virtual Memory

But understanding virtual memory is another matter, because it's very different from the physical memory in our computers. So, what is virtual memory? How does it work? And why is it so important? Let's find out.

What is virtual memory?

Virtual memory, sometimes referred to as virtual storage, is a memory management technique employed in computing devices. The purpose of this memory is to ensure sufficient space is acquired from physical storage and to present an appearance of a much larger memory capacity than the actual physical memory or main memory. It allows the operating system to utilize hard disk space to simulate RAM, thereby extending memory capacity when RAM is insufficient. As such, programs can continue running even when physical memory is full, albeit potentially at a slower pace since accessing the hard disk is slower than RAM.

This is primarily achieved through the operating system and technologies it has adopted over the years, which enable it to use a combination of software and hardware methods to map some virtual memory into main memory.

Yes, it's the same system/virtual memory that many tech experts recommend you adjust to speed up your computer's performance. Additionally, since one of the main purposes of virtual memory is to make application programming easier, it hides the fragmentation of physical memory.

Here's an example of how to run the DXDIAG command:

DirectX Diagnostic Tool

The red indicates the system's physical memory, or RAM. The green numbers show shared memory from the device to the RAM, which helps keep things running smoothly. It is an essential component of any computer operation/architecture.

In modern computers, this virtual memory is typically implemented as paged memory, which uses some of the space on our storage devices to augment the capacity of physical memory.

While it cannot work directly as effective physical memory, it does help when the physical memory is under extreme load and stress. Depending on the RAM bus size and the bus supported by the CPU, this can add up to double the actual memory size.

For example, if you have 8 GB of physical RAM installed on your computer, the page file size might be slightly larger, say 8.5 GB. However, you can manually assign more memory to ensure smooth performance.

It's important to remember, though, that this takes up space on your drive, making it effectively unusable. This is one reason why computers with smaller drives can run slowly or become unresponsive.

Virtual Memory vs Physical Memory

The difference between virtual memory and physical memory is quite literal – one is physical, and the other is virtual. However, to help you grasp the concept, let's outline some key information in a comparison table: | Feature | Virtual Memory | Physical Memory | | --- | --- | --- | | Storage Location | An area on the hard drive simulating memory space | The computer's RAM (Random Access Memory) | | Handling | Managed by the operating system, swapping less frequently used data to the hard drive | Directly accessed and processed by the CPU | | Capacity | Can be larger than physical memory, depending on hard drive space | Limited by the size of installed RAM | | Speed | Slower, as data needs to be read from the hard drive | Faster, as data is accessed directly in RAM | | Function | Extends memory capacity and provides a contiguous address space | Offers fast data storage and processing | | Working Principle | Moves parts of program data to the hard drive when physical memory is insufficient | Stores running programs and data | | Reliability | Data can be lost if power is interrupted | Data is typically not lost after a power outage | | Practical Application | Common in large programs or multi-tasking environments | Suited for applications requiring quick response | This table summarizes the main differences and functions of virtual memory and physical memory. Hopefully, this clarifies the concepts for you.

VIRTUAL MEMORY PHYSICAL MEMORY
Virtual memory is stored in the space on your hard drive allocated to the page file. Physical memory is the chips you buy and install in your motherboard's DIMM slots.
Virtual memory comes into play when physical memory/RAM is maxed out. Physical memory/RAM is the primary memory that a computer uses from the get-go.
Virtual memory is slower, as it relies on your hard drive or SSD. Physical memory is designed for speed, ensuring snappy operation.
You can increase virtual memory by manually allocating more hard drive space. The size of physical memory is limited by the size of the chips on the RAM modules.
Virtual memory stores information in pages on the hard drive, thus the name “page file” and its associated size. Physical memory stores data within RAM chips, wiping them clean once operations are complete (like closing a document).
Boosting virtual memory doesn't make a noticeable difference in performance. Adding more physical memory can significantly improve your PC's performance.

These differences indicate that physical RAM is faster and better for running applications. However, when physical RAM usage reaches 100%, virtual memory kicks in as a backup. Don't expect, though, that allocating more space to it will work miracles for your performance.

That leads to the common question: Is virtual memory better than RAM? The short answer is no – but you can't have one without the other. You always need virtual memory to allow physical RAM to work effectively.

How much virtual memory should I set?

In most modern operating systems, such as Windows 10 and 11, the OS automatically manages the size of virtual memory or the page file. However, if you feel the need for more virtual memory, remember this:

    Minimum paging file size = 1.5 times the amount of physical memory Maximum paging file size = 4 times the amount of physical memory

Here's a chart to help you decide how much disk space to allocate for virtual memory:

Physical Memory Size Minimum Page File Size Maximum Page File Size
8 GB 12 GB 32 GB
16 GB 24 GB 64 GB
32 GB 48 GB 128 GB

Now, it's easy to see why not many people would have 32GB of RAM and 128GB of storage to spare. This is why it's best to let your operating system decide how big the page file needs to be.

That's simply because the page file grows over time as you use your computer, since the operating system automatically increases the size of virtual memory when your RAM is close to its limit.

How do I increase virtual memory in Windows 10?

While it's recommended to let Windows 10 or 11 adjust virtual memory automatically, you can do it manually if you want. Only do this if you're experiencing lag or slow performance with apps, though. Here's how:

Step 1: Go to System Settings

Step 2: Under Device specifications, click Advanced system settings.

Windows System Settings

Step 3: Click the "Settings" under the "Performance" banner.

Step 4: Go to the Advanced tab, and click Change under Virtual Memory.

Untick the checkbox for Let Windows manage the paging file size for all drives.

Step 6: Click on "Custom size" and set "Initial size" to 1.5 times your RAM and "Maximum size" to 4 times your RAM.

Step 7: Click OK.

This will allow you to increase your computer's virtual memory. It's important to note that users with 16 GB or more of RAM do not need to manually increase the size of the page file, as the operating system will automatically adjust it for optimal performance.

Bottom line

We hope this article has cleared up any confusion and questions you had about virtual memory. We also discussed the differences between virtual and physical memory, including how they rely on each other.