SoFunction
Updated on 2025-04-14

The ultimate guide to setting virtual memory under Windows system

Memory is very useful in a computer. All running programs in the computer need to be executed through memory. If the executed programs are large or many, the memory will be exhausted. To solve this problem, Windows uses virtual memory technology, that is, taking out part of the hard disk space to serve as memory. When the memory is used up, the computer will automatically call the hard disk to serve as memory to relieve memory tension. For example, if the computer only has 128MB of physical memory, when reading a file with a capacity of 200MB, it is necessary to use relatively large virtual memory. After the file is read by memory, it will be stored in the virtual memory first. After the memory stores all the files in the virtual memory, the files stored in the virtual memory will be released into the original installation directory.
When the system is running, the required instructions and data must be transferred into memory from external memory (such as hard disk, floppy disk, optical disk, etc.), and the CPU then reads instructions or data from memory for calculation, and stores the calculation results in memory. The role of memory is like a "second-hand man". When running a program requires a lot of data and occupies a lot of memory, the memory warehouse will be "filled", and there is always a part of the temporarily unused data in this "warehouse" that occupies a limited space, so you should "please" this part of the "lazy" data to make room for "active" data. Then you need to create another backup“storehouse”Go and store“Inert”data。 Due to the large space of the hard disk,So MicrosoftWindowsThe operating system will be backed up“storehouse”The address is selected on the hard disk,This backup“storehouse”It's virtual memory。 By default,Virtual memory is stored in the hard disk system partition with a swap file named。
Manually set up virtual memory
By default, the system is allowed to manage virtual memory, but the management method of the system default settings is usually conservative. During automatic adjustment, the page file will be discontinuous, which will reduce the reading and writing efficiency and the work efficiency will not be high. Therefore, there are often prompts such as "insufficient memory". Let us set it up by ourselves.
① Right-click the "My Computer" icon on the desktop, and select the "Properties" option in the right-click menu that appears to open the "System Properties" window. Click the "Advanced" tab in the window and a dialog box for Advanced Settings appears.
②Click the "Settings" button in the "Performance" area, select the "Advanced" tab in the "Performance Options" window that appears, and open its dialog box.
③ In this dialog box, you can see the area about virtual memory. Click the "Change" button to enter the settings window of "Virtual Memory". Select a partition with a large free capacity, check the check box before "Customize Size", fill in the specific values ​​into the "Initial Size" and "Maximum Value" columns, and then click the "Settings → OK" buttons in turn, and finally restart the computer to make the virtual memory settings take effect.
Suggestion: A small partition can be divided into a special partition for virtual memory, IE temporary file storage, etc. In the future, the partition can be regularly disk-sorted, which can better improve the computer's work efficiency.
1. Customized virtual memory
1. Normal setting method
According to the general setting method, the minimum and maximum values ​​of virtual memory swap files can be set to 1.5 times the memory capacity, but if the memory itself has a relatively large capacity, such as 512MB, then it occupies considerable space. So we can set the basic value of virtual memory in this way: if the memory capacity is below 256MB, it is set to 1.5 times; if it is above 512MB, it is set to half of the memory capacity; if it is between 256MB and 512MB, it is set to the same value as the memory capacity.
2. Accurate setting method
Since the application that everyone actually operates cannot be the same, for example, some people want to run large programs such as 3DMAX and Photoshop, while some people may just type and play small games, so the requirements for virtual memory are not the same, so we must accurately set the value of the virtual memory space according to local conditions.
① First set the "initial size" and "maximum value" of the virtual memory to two identical values, such as 500MB;
② Then open "Control Panel → Management Tools → Performance". In the "Performance" dialog box that appears, expand "Performance Logs and Alerts" in the left column, select "Counter Logs" below, right-click in the blank space in the right column, and select the "New Log Settings" option in the right-click menu;
③Fill in the "Name" column of the pop-up dialog box, such as "Virtual Memory Test". Click the "Add Counter" button in the window that appears to enter the next window;
④ Open the drop-down list of "Performance Objects" in this window, select "Paging File", check "Select Counter from List", and select "%Usage Peak" in the column below; check "Select Example from List", select "_Total" in the column below, and then click "Add → Close" to end
⑤ In the column on the right, you can find an additional "Virtual Memory Test" project. If the project is red, it means that it has not started yet. Click this item and select the "Start" option in the right-click menu.
Next, run some of your commonly used applications. After running for a period of time, enter the default directory "PerfLogs" in the system partition where the log file is located, find "Virtual Memory Test_000001.csv" and open it with the Notepad program. In this content, we check the second-last item value in each column. This value is the usage ratio of virtual memory and find the maximum value of this value, such as "46" in the figure, multiply 46% by 500MB (the virtual memory value set earlier), and the value is 230MB.
This value allows you to set the initial size to 230MB, and the maximum value can be set freely according to the disk space size. It is generally recommended to set it to 2 to 3 times the minimum value. In this way, we can create virtual memory more accurately, making our love machine run smoother and more efficiently.
2. Windows virtual memory acceleration password
Virtual memory is very important for any version of Windows. If set up properly, it will greatly improve the performance and running speed of your computer. However, by default, Windows always sets virtual memory to 1.5 times the physical memory. In this way, if the user installs 2GB of memory, the system will free up up to 3GB of hard disk space as virtual memory. However, judging from the memory needs of current mainstream application software and games, there is no need to use so much virtual memory. So, are there any secret techniques or tricks that can make virtual memory more efficient or more performance-producing?
1. Split and stored on multiple hard disks
Setting virtual memory on a faster hard disk can indeed make the operation of virtual memory more efficient. However, if two hard disks on the computer are as fast as the speed, the virtual memory should be distributed evenly on two different hard disks (not different partitions of the same hard disk). Because synchronous reading and writing operations will more effectively improve the overall virtual memory performance of the system.
For example, suppose you originally set 700MB of virtual memory on hard disk C, now you can try to re-allocate, that is, change hard disk C to 350MB, and add 350MB of virtual memory to hard disk D. In theory, doing so will speed up the overall read and write operations of virtual memory.
2. There must be enough space for the hard drive
If you are not a very experienced computer user, or do not have special usage requirements, selecting the "System-managed Size" method in Windows XP to automatically handle virtual memory, it should generally be safer and stable than choosing the "Custom Size" method. However, there is one thing that everyone must note that since the "page file" () of virtual memory will shrink and expand as the computer is used, in order for the system to manage virtual memory to proceed smoothly and more resiliently, we must ensure that the hard disk where the paging file is located has enough free space.
3. The minimum value is equal to the maximum value
Select the Custom Size method to handle virtual memory and set both the maximum and minimum values ​​to the same value. Many people believe that using this method to handle virtual memory can help improve system performance. The reason they hold is that when the maximum and minimum values ​​are equal, the system does not need to shrink and expand the page file at all times. By eliminating these tasks, the system efficiency is improved accordingly.
Many people firmly believe that this method is effective, but similarly, some people point out that it is actually not effective. But no matter what, if we want to set the maximum and minimum values ​​to be equal, we must adhere to one principle, that is, the size of virtual memory must be sufficient, otherwise the system will experience a decrease in efficiency at a light level (more rewrite actions are required to make room), and in severe cases, it will cause system instability.
4. Organize page files
If the file data is stored on the hard disk for a long time, file fragments will naturally occur. To maintain or improve the working efficiency of the hard disk, we should defragment the hard disk from time to time. The so-called virtual memory is actually a data file on the hard disk. So should virtual memory also need to be sorted out like ordinary files?
The method of processing page files (i.e. virtual memory) in Windows systems is different from that of ordinary files. In contrast, page files appear less fragmented than ordinary files, and it is usually unnecessary to organize page files. In fact, when Windows XP performs disk defragmentation, the page files are not involved.
Although Windows will not organize page files, in fact, there are fragments of page files. Friends who pursue "perfection" may still want to defragment the page files. You might as well try the following method:
Right-click the My Computer icon on the desktop and select Properties from the function menu that appears. Enter the settings window of system properties, click "Advanced" --> "Performance" --> "Settings" --> "Advanced" --> "Change" with the mouse, and select the "No paging file" item in the "Virtual Memory" setting window that appears later. Finally, click the "Settings" button to exit and restart the computer.
After restarting, check if there are any page files in the root directory of the disk, and delete them if there is one. After clearing the page file of virtual memory, we now defragment the disk. After completion, follow the previous steps to reset a certain amount of virtual memory and start the computer to take effect. After processing by the above method, the newly obtained page file will be fragmented.
In addition, what if you want to see the specific situation of page file fragments? Start the disk defragmentation program, perform an "analysis" for the hard disk with page files, and then click "View Report" to see the "Page File Fragment" column to see it at a glance.
5. The ideal size of virtual memory
If you want to use the "customized size" method to handle virtual memory, how large should you set? In Windows XP, if the operating system defines virtual memory itself, the system will usually set the minimum value to 1.5 times the physical memory. When expanded, the maximum value is between 2.5 and 3 times the physical memory. Generally speaking, if users want to customize the size of virtual memory, they can refer to this scale setting.
Do I really need to refer to this ratio? If my computer has 1GB of memory, is it possible to set the minimum value to 1.5GB and the maximum value is 2.5 to 3GB. This way. The page file is at least 1.5GB, which is too unrealistic!
In fact, compared with systems with large memory, the standards for setting virtual memory are somewhat different.
If you have more than 512MB or even 1GB of memory, since the physical memory is already quite sufficient, the required virtual memory should be reduced. Therefore, in a system with large memory, the minimum value of virtual memory can be set to half of physical memory. For example, if there is 1GB of memory, the minimum value of virtual memory is set to 512MB, and the maximum value is maintained at 3GB for emergencies. Note: Although the maximum value is set to 3GB, the system will not immediately appear with a 3GB size file. In fact, it will appear at the minimum value first and will only increase when it is necessary to expand.
In addition, some friends with large memory may simply not set up virtual memory, so as to force the system to use faster memory. Actually, this is not very wise. As the saying goes, don’t do anything too absolute, and it’s not OK to have virtual memory at all. The reason is that many applications require the use of virtual memory when designing, which will cause system instability or crash.
As for systems with small memory, such as 256MB, the most stable ratio is to refer to the settings of 1.5 times and 3 times. That is, the minimum value of virtual memory is set to 384MB and the maximum value is 768MB.
6. Manually customize the most accurate virtual memory
0.5 times, 1.5 times, 3 times, wow! It seems that when buying clothes, it is large, medium and small, and it has no personality at all. Is there a more "fitting" way to set up virtual memory?
Enter in "Start" → "Run" on the Windows XP desktop and a monitor related to system performance will appear. Look at the bottom of the monitor, there are three counters (pages/sec, Queue Length and rocker Time,). In order to facilitate our accurate monitoring of the page files in virtual memory, please select these three counters one by one and press the Delete key on the keyboard to delete them. Please rest assured that after deleting, these three items will reappear the next time you start the system performance monitor again.
After deleting, now right-click the center of the chart, click the "Add counter" item in the function menu that appears afterwards, and then select "Process" in the "Performance Object" column that pops out of the window. Then click "Page File Bytes" in the "Select from List" column. It is not clear what "Page File Bytes" means. Just click the "Description" button and the commentary text will appear under the dialog box.
After selecting "Page File Bytes", select the "Total" item in the "Select Example from List" column on the right, and then click the "Add" and "Close" buttons in turn. A counter named "Page File Bytes" will appear below the performance monitor.
Repeat the above action and add a counter called "Page File Bytes Peak” (i.e. Page File Bytes Peak below Process).
Now, looking back at the monitor, the chart should be showing and measuring the two newly added counters. If nothing unexpected happens, the display of these two counters on the chart is incorrect, that is, the value is close to the highest proportional line and there is no dynamic change. Don't be afraid, this does not mean that something is wrong with your computer, but that the chart scale is not set properly! Right-click the "Page Fele Bytes” and "Page File By8tes Peak” counters at the bottom of the monitor one by one, and select the "Properties". Change it to 0.0000001 in the "Scale" column of the "Data" page, so that the charts in the monitor will no longer be inactive.
If you have read the instructions provided by the system, I believe you should know that "Page File Bytes” and "Page File Bytes Peak” represent the virtual memory used during system monitoring and its peak. Therefore, it is necessary to set the virtual memory accurately manually. You can refer to the numbers displayed below the chart, and their units are Bytes
Want to know how much virtual memory your system will consume under normal circumstances? Please start up the application software you usually use and start working at the same time. Then look at the values ​​displayed on the performance monitor and have a clear idea.
People always have crazy times. They want to know how much virtual memory the system needs when using the computer crazy. Now they can start and run the programs on the computer to their heart's content (for example, open more than a dozen IE browser windows to surf the Internet, play MP3 and DVD videos, and then burn CDs or compress and encode DV videos) to see how much the percentage of the monitor will increase.
Right-click the mouse on the chart, click "Properties", and enter the "Chart" page to check the "Horizontal Grid". In this way, horizontal dividing lines will appear in the chart. Isn’t it easy to distinguish?
The red vertical line in the chart runs too fast to start the program on the computer for testing?
Similarly, right-click on the chart, select "Properties", and change 1 second to 5 seconds in the "Auto Sampling Interval" item on the regular page. At this time, the "graphic time" value in the chart will change from 1 minute 40 seconds to 8 minutes 20 seconds. In other words, it takes 8 minutes and 20 seconds to walk a red vertical line, which should be enough for everyone to open and run many applications, and then slowly view the results in the chart.
Finally, through the monitor chart, I believe everyone can already roughly estimate how much virtual memory your computer system should set.
3. Several possibilities of "insufficient virtual memory"
1. Infection with viruses
Some viruses will occupy a lot of memory space when they occur, resulting in insufficient memory in the system. Hurry up and get anti-virus measures in place, upgrade the virus database, and then take good anti-virus measures!
2. Improper virtual memory settings
Improper virtual memory settings may also lead to insufficient memory. Generally speaking, the virtual memory size is twice the physical memory size. If the setting is too small, it will affect the normal operation of the system program. Re-adjust the virtual memory size, take WinXP as an example, right-click "My Computer", select "Properties", then in the "Advanced" tab page, click the "Settings" button in the "Performance" box, switch to the "Advanced" tab page, and then click the "Change" button in the "Virtual Memory" box, then reset the virtual memory size, and restart the system after completion.
3. Insufficient system space
The virtual memory file is in the system disk by default. For example, the virtual memory file name of WinXP is "". If the remaining space in the system disk is too small, resulting in insufficient virtual memory, there will also be insufficient memory. The system disk must retain at least 300MB of remaining space, of course, this value must be determined according to the actual needs of the user. Users try not to install various application software on the system disk to ensure that there is enough space for virtual memory files, and it is best to place virtual memory files on a non-system disk.
4. Because SYSTEM user permissions are set incorrectly
When the Windows system based on the NT kernel is started, the SYSTEM user will create a virtual memory file for the system. For the sake of system security, some users use NTFS file system, but cancel the permissions of SYSTEM users to "write" and "modify" the system disk, so that they cannot create virtual memory files for the system. When running large programs, there will also be insufficient memory problems. The problem is easy to solve. Just re-grant the SYSTEM user the permissions to "write" and "modify", but this is only limited to users who use the NTFS file system.
4. Optimization of virtual memory
1. Enable disk write cache
Right-click on "My Computer" and select "Properties -> Hardware", open Device Manager to find the currently used hard disk, and right-click to select properties. On the Policy page of hard disk properties, open Enable write cache on disk.
This option will activate the hard disk's write cache, thereby increasing the hard disk's read and write speed. However, one thing to note is that if the computer suddenly loses power after this function is turned on, it may lead to irretrieval data loss. Therefore, it is best to turn on this function when there is UPS. Of course, if you don’t do any important data processing when using your computer normally, it doesn’t matter if you don’t have a UPS, and this function will not cause too much loss to the system.
2. Open Ultra MDA
In Device Management, select "Basic/Second IDE Controller" in IDE ATA/ATAPI Controller, right-click and select "Properties" to open the "Advanced Settings" page. The most important setting item here is "transmission mode", and you should generally choose "DMA (if available).
3. Configure recovery options
When Windows XP encounters a fatal error during operation, it will save the snapshot of the memory as a file for use during system debugging. For most ordinary users, this file is of no use, and will affect the performance of virtual memory. So it should be turned off.
Right-click on "My Computer", select "Properties -> Advanced", click the "Settings" button under "Performance", and select the "Advanced" page in "Performance Options". There is a "memory usage" option here. If you set it to "system cache", Windows XP will use about 4MB of physical memory as a cache for reading and writing hard disks, which can greatly improve the data exchange speed between physical memory and virtual memory. By default, this option is turned off. If the computer has sufficient physical memory, such as 256M or more, it is best to turn on this option. However, if the physical memory is tight, the default option should still be retained.
Page file settings
Calculate the size of the page file
The size of page files varies for different computers. Regarding the setting of page file size, there are two widely circulated "formula": "physical memory X2.5" or "physical memory X1.5". These two calculation methods are simple, but they are not suitable for all computers. The most accurate way to set the page file size is to see the page file size that the computer actually uses in normal operation.
The logging function that comes with Windows XP can monitor the size of the page files that the computer usually uses, so as to make the most accurate settings. The specific steps are as follows.
1. Right-click on "My Computer", select "Properties->Advanced", click the "Settings" button under "Performance", then select the "Advanced" page, and click the "Change" button under "Virtual Memory". Select Custom Size and set both Start Size and Maximum to 300M, this is just a temporary setting. After the settings are completed, restart the computer to make the settings take effect.
2. Enter "Control Panel->Performance and Maintenance->Management Tools", open "Performance", expand "Performance Logs and Warnings", and select "Counter Logs". Right-click on the right side of the window to select "New Log Settings"
3. Set any log name, such as "monitoring virtual memory size".
4. Click the "Add Counter" button on the "General" page.
Select "Paging File" in "Performance Object", then select "%Usage Peak" under "Select Recorder from List", and select "_Total" in "Select Example from List" on the right. Finally click the Add and Close buttons.
5. Don’t forget to remember the location and file name of the log file in the "Log File" page. We need to check this log later to determine how much virtual memory Windows XP usually uses. In this example, the log file is stored in the D:\Perflog directory.
In addition, you must set the "log file type" to "text file" to facilitate reading.
At this time, you can see that the icon on the newly created log entry has turned green, which indicates that the log system is already monitoring the virtual memory. If the icon is still red, you should right-click and select "Start" to start the log.
After a while, open this CVS file and we can see the entry for the following content.
This log file records the usage of page files during this period of time. Note that the unit here is % instead of MB. Through simple calculations, we can get the minimum size of the page file, and the formula is "Page file size X percentage". For example, in this example, the maximum usage ratio of virtual memory is 31%, 300MBX31%=93MB, which is the minimum value of virtual memory (note that 300MB is the temporary value set in the previous setting).
If the physical memory is large, you can consider setting the "Size" and "Maximum" of the page file to equal, which is equal to the size calculated in the previous step. In this way, the disk fragmentation will not occur due to the transition of page files in the hard disk. The side effect is that the "maximum value" is set to be small. In case of accidental virtual memory overrun, the system may crash.
Set page file
Now return to the Settings dialog box of "Virtual Memory" and select the custom size and set the "Initial Size" and "Maximum Value" respectively according to the above calculation results. Here we set the "initial size" to 91M, and the "maximum value" to 200M, which is safer
Defragment of page files
Windows XP requires a large number of access to page files when running. If the page files are fragmented, system performance will be severely affected and the service life of the hard disk will be shortened. So it is very necessary for us to defragment the page files regularly.
But don't forget that page files are system key files and cannot be accessed when Windows XP is running. So defragmenting it is not easy. We have two options to choose from. One is to install Windows dual systems, and then start another Windows to defragment the partition where Windows XP is located. The second is to use special tool software, such as System File Defragmenter.