Useful Tips

Paging file and correct sizes for different memory sizes

When working in Windows, all data is stored either permanently, on the hard disk, or temporarily, in random access memory (RAM). When the RAM starts to run out, some of the information is dumped into the page file. Virtual memory uses the system paging file to wipe unused pages of memory onto disk. In most cases, the size of the page file is determined automatically by the system. If this is not enough, you can change it manually.

Right click on the icon My computer open The properties - tab Additionally - in section Performance press the button [Options].

In the window that opens Performance options open the tab Additionally and press the button [Change].

Next window Virtual memory contains tools for configuring virtual memory parameters, namely the size of the page file. Most likely, the value is set here. System selectable size. The list shows the page file size for each drive. To install it manually, select the option Custom size and enter the values ​​in the fields Original size and Max size.

Let's talk separately about the principles of setting up virtual memory. Some recommend that you do not select a system drive for the swap file, but any additional drive, one that is less loaded. If the system has only one disk, then this option is not for us.

Another important point - the minimum value should be 1.5 times the amount of RAM. In other words, if the RAM is 1 GB, then in the field Original size enter about 1500 MB.

Regarding the maximum size, there are also several opinions. In some cases, it can be made the same as the minimum size, and in some more than twice. The main thing is that the maximum value does not exceed the amount of free disk space. Otherwise, the system will display messages about the lack of virtual memory. It follows that on a disk with a swap file, you should always monitor the free space.

After entering the values, we must press the button [Ask]otherwise the swap file size will not change.

To remove the page file from the disk, select it in the list and select the option No swap file.

In many cases, after increasing the size of virtual memory, system performance noticeably increases.

Swap file and size - theory

Empirically, it was possible to prove that the large size of the swap file is not good, or rather, often, even bad. With large file sizes and busy RAM, the system is increasingly accessing the swap file (i.e., the hard disk) rather than the RAM itself, which, firstly, reduces performance (RAM is faster than the disk).

Secondly, this heavily loads the disk (which also affects performance because the disk is also engaged in other file operations, and here it also has to bother with the swap file).

Therefore, I personally would recommend reducing the size of the widow paging file below the recommended, and sometimes even stronger. This advice is of course relevant with a sufficient amount of RAM on the computer.

What is enough?

  • This is when, when performing any tasks you need, there is always free RAM in the amount above 30% and the system does not swear that it does not have enough virtual memory,
  • In general, for example, I rarely noticed that 4 GB of operative memory (even with a system heavily loaded with processes and games) left little free RAM, as well as with a bunch of running applications in Windows there were some problems of 8 GB. So why load the disk with a swap file and lose performance?

Many, of course, will say that they don’t give a damn about how much memory to put and still leave free .. I don’t know if performance is important to you, then the extra 100 rubles should not bother you, since the price of RAM is now ridiculous ( the time of writing the article 4GB 1600MHz DDR3 cost less than 1300 rubles), especially since the gain in performance is obvious. However, to the point.

Optimal swap file sizes

It is believed that in order to get good performance, you need to set the minimum size of the swap file equal to the amount of RAM, and the maximum - twice as much. That is, if the computer has 2 GB of RAM, then the minimum and maximum sizes of 2 and 4 GB should be set for the swap file, respectively. Setting these two parameters with different values ​​leads to the fact that the actual size of this disk memory object changes dynamically, which means that it will undergo fragmentation and reduce performance. Therefore, many users set the same value. In this case, pagefile.sys becomes static (not fragmentable), which reduces the load on the system and increases its speed. But in the case of a dynamic swap file, there is a way to eliminate performance degradation if you enable file cleaning when the operating system shuts down.

Clearing a swap file at shutdown

To enable cleaning of the pagefile.sys file when the operating system shuts down, you must run the secpol.msc command ("Start - Run") in command line mode. In the window that opens, you should find the element "shutdown: cleaning the swap file ...". By double-clicking on it, we set the security parameter to “Enabled” and click the “Apply” button. These actions are shown in the following two figures.

Choosing a swap file location

Windows 7 allows you to place the swap file simultaneously on multiple disks, but this option does not increase system performance. The most optimal way with respect to performance is a single swap file located on any partition on the hard drive except the system partition. To change the location of pagefile.sys, you must first delete it and then create it in the right place. To do this, click "Start", and then "My Computer - Properties" (right mouse button). In the window that appears, click on "Advanced system settings."

A window will open in which you need to select the "Advanced" tab.

Here, in the "Performance" section, click the "Options" button and in the window that opens, select the "Advanced" tab again. We turn to the section "Virtual memory" and click the "Change" button. A window opens that allows you to set the location and size of swap files on any partitions of your hard drives. The same window allows you to both disable the page file and enable it.

As already mentioned, by default, Windows 7 places pagefile.sys in the system partition of the disk, which can be seen in the activated item "Size of the choice of the system." To transfer the swap file to another partition, select it, activate the "Without swap file" item and click the "Set" button. With these actions, the swap file is deleted from its previous location. Sometimes after that a message appears warning that this file was disabled or that its volume was set too small, which could lead to a system error. In this message, just click "Yes."

Now go on to create the file in the right place. For this:

  • Select the desired disk partition.
  • We activate the item "Specify Size".
  • Set the file size (minimum maximum).
  • Click the "Set" button.

All these actions are shown in the following figure.

In the above figure, the user created a dynamic swap file with a maximum size that is twice the minimum size. If you want to create a static pagefile.sys, these parameters should be the same.

It should be noted that the swap file can be resized without changing its location. To do this, all the above steps must be performed without changing the disk partition. Of course, it is unnecessary to say that in all windows with the “OK” button it should be clicked at the end of all the required actions. And one more thing: when the volume changes in the direction of decreasing, the changes take effect instantly, otherwise a reboot may be necessary, about which the user will receive a message in which you need to click "OK".

Disabling and enabling the swap file

Many users often resort to disabling the swap file. This is justified in cases where a RAM of a sufficiently large size is installed in the computer. Indeed, why spend time swapping and slow down the system if you can simply add one or more RAM slots. The cost of RAM at this time is not so great, but an increase in the amount of installed RAM and disabling the swap file can give a significant increase in performance, especially with a not very powerful computer. Disabling the swap file is easy - just delete it by setting the “No swap file” checkbox, as shown in the penultimate figure.

Enabling a swap file is as simple as disabling it - you just need to uncheck “without a swap file” and set “Size at the choice of the system” or set its values.

Useful Tips

We will try to give some recommendations from experienced users on setting up and optimizing the page file. Here they are:

  • Needless to say, the ideal option would be sys, located on a separate partition on the hard drive.
  • The financial situation of the user will not be greatly shaken if he installs additional RAM slots and generally abandons virtual memory. This will increase the speed of Windows. 6 GB of RAM will be enough for it.
  • Windows 7 produces a constant increase in the size of the swap file, which leads to fragmentation of the hard disk and unnecessary overhead. Therefore, it is recommended to set your size with the same values ​​for the minimum and maximum sizes.
  • You should not set the file size to less than 1 GB, otherwise fragmentation of the hard disk is possible.
  • A separate recommendation requires the case of use as a system SSD-drive. This is a solid state drive that does not have mechanical rotating elements. In fact, this is a large flash drive with a very high read / write speed, usually an order of magnitude higher than the speed of hard drives. But with all its very good speed parameters, it has a limited number of write-read cycles. Therefore, it is very important to ensure a minimum number of overwrites on it, and for this you need to either disable the swap file altogether, or make it static.

What is a swap file?

First, a little theory. A swap file is a special file that Windows accesses if the PC does not have enough current RAM to work. Simply put, this is a virtual memory that is added to the current, which improves the speed of a laptop or computer.

Of course, there are several points:

  1. The increase in virtual memory can slow down the computer. After all, the speed of access to RAM is much faster than to the hard drive (namely, the swap file is stored on it).
  2. Using this function creates an extra load on the HDD-drive and reduces its working time.

How to increase virtual memory in Windows 7

  1. Go to Start - Control Panel - System.
  2. Click on “Add. options".
  3. Find the Performance section and click on Options.
  4. In the new window, select the "Advanced" tab.

This is where virtual memory is configured. As a rule, the size currently used is already indicated here (in the screenshot below it is 8173 Mb, i.e. 8 GB). To increase virtual memory in Windows 7, click on the "Change" button.

The same window will appear where you can configure the page file.

If the PC or laptop slows down, it means that there is not enough RAM and it needs to be increased. To get started, uncheck the box. All buttons will become active, and you can enable the page file in Windows 7 and configure it as you wish. To do this, check the box "Specify size" and write down the source and max. volume. For example, 4096 MB (this is 4 GB).

By the way, what is the optimal paging file size? There are a lot of tips on this issue on the Internet, and the calculation formulas are also intricate.

The best option is to increase the virtual memory of the computer by 50% of the amount of your RAM. That is, the page file for 4 GB will be 2048 MB. And for 8 GB of RAM, you can specify 4096 MB. As a result, the total memory will be 6 and 12 GB, respectively - this should be enough for all occasions.

After you have added virtual memory, click “OK” and restart your PC or laptop. After all, the changes will be applied only after a reboot.

If you have a lot of RAM installed on your PC (for example, 8 GB), and you only work on the Internet, then you can generally disable the page file. After all, as I said above, it loads the hard drive, which sometimes slows down the PC.

In general, if you need to increase virtual memory in Windows 7 - specify it manually. And if you need to restore the previous values, check the very first paragraph and close this window.

The swap file in Windows 8 is configured in the same way (as in the "seven")

And in order not to go into Start and not open many windows, you can do simpler:

  1. Press Win + R.
  2. Type sysdm.cpl and press Enter.
  3. Select the “Advanced” tab and go to “Options”.
  4. Click on the “Advanced” tab, and then on the “Change” button.

Done. All that remains is to configure the swap file in Windows 8. To enable virtual memory, write down the desired size, click OK and reboot the PC or laptop.

Setting up the page file in Windows 10 is a bit different. Although there is nothing complicated here.

To enable the swap file in Windows 10:

  1. Go to Start, write in the search field the word “production” and select the item found.
  2. Click the Advanced tab and click Edit.
  3. A familiar window will open, where you can increase virtual memory in Windows 10.
  4. Write the desired size, apply the changes and restart the PC or laptop.

Swap file and sizes, practice: which ones are right and why

In the course of a year's practice, I deduced a number of digits for each amount of memory, so that I could adequately set the page file based on the number of RAMs. Here they are.

  • 512 Mb RAM, - the optimal paging file size is from 5012-5012 Mb,
  • 1024 Mb of RAM, - the optimal paging file size is from 4012-4012 Mb,
  • 2048 Mb of RAM, - the optimal paging file size is from 3548-3548 Mb,
  • 4096 Mb of RAM, - the optimal paging file size is from 3024-3024 Mb,
  • 8 GB of RAM, - the optimal paging file size from 2016-2016 Mb,
  • 16 GB of RAM (and more), most often without a swap file.

In fact, the more RAM you have, the less you need a swap file and the faster the system will work without it at all (due to reduced disk access, as well as data unloading there, i.e. everything will be taken directly from memory directly )

  • Note 1 These dimensions are not extremely accurate and recommended to everyone. Rather, this is a kind of average value for most, but it all depends on how much your system is optimized, what you do on your computer, in what mode, etc., etc., i.e. you can select the page file for your needs and increase / decrease value if necessary.
  • Note 2 Some applications (games, software, etc) require a swap file without fail, regardless of the amount of memory. In this case, the file should be left even at 16 GB. Even more (by orders of magnitude) than the values ​​indicated above.
  • Note 3 The swap file is needed in large (different from the above) sizes if you minimize applications and switch to others, leaving the application (s) running (this is important), because often the unloaded applications are unloaded to this very file. In this case, increase the swap .. Or add memory :)
  • Note 4 The recommendations do not apply to server operating systems and relate strictly to user OS.

Personally, my opinion is that if the amount of RAM exceeds 6 GB, the paging file is not needed at all, which gives a tangible breakthrough in system performance, extending the life of the hard drive and reducing fragmentation.


For those who have forgotten, I remind you that, for example, in Windows 7, the swap file changes along this path: "Start - Settings - Control Panel - System - Advanced System Settings - Advanced - Speed ​​- Settings" (in the control panel, enable small icons to see category "System")

The location of the page file in the system

The swap file is located on a faster physical (non-logical, i.e. partition) disk. Or, if the disks are approximately equal in speed, then on the one where the system is not installed, as well as the applications that you will use. That is, on a disk that is maximally unloaded from read-write operations.

If there is only one disk, then the swap file should be located on a different (different) from the application that you will use (i.e., let's say you have games on D: , then place the file on E: or, if there is none, then on C: ), a logical partition and / or separately from the system. It is rare, but advisable, to make a separate section for these needs.

В общем принцип прост:

  • На максимально быстром (или просто другом от используемых приложений) физическом диске,
  • Или на другом от (используемых приложений) разделе.

Проверить скорость диска можно, например, с помощью HD Tune о котором говорилось в этой статье.

Файл подкачки и почему мы выбираем одинаковые размеры

The swap file, like any other, has a tendency to fragment, which raises the question of the need for defragmentation (what defragmentation is and why you need to read it here) in order to return to its former performance. However, there is a way to reduce the speed and power of fragmentation of this file.

To do this, simply set the maximum and minimum sizes to be the same:


There is one more point in this action.

With the same minimum and maximum values, the system understands that there is no need to control file sizes, because it is fixed, and this, again, removes a number of operations and disk accesses, which positively affects the overall performance gain.

Afterword

In a nutshell, something like that.

I hope that these tips were useful to you and really increased the work of your system. There are many other goodies on the tag "Optimization".

If you have any questions, I will be glad to answer them in the comments or using the feedback form.

PS: The last adjustment of the page file size was made in August 2017, the data was checked on Windows 7, 8 and 10 (x64 bit capacity).