How to manage Pagefile virtual memory in Windows 10

How to manage Pagefile virtual memory in Windows 10

General information

Paging is a memory management scheme whereby a PC can store and retrieve data from the mass memory for use in the main memory. According to this scheme, the operating system retrieves data from the secondary storage in blocks of the same size called pages. Paging is an important part of implementing virtual memory on modern operating systems. These operating systems use mass memory to allow programs that may have volumes exceeding the size of available physical memory.

Simply put, the main memory is called random-access memory (RAM), while the secondary storage memory is called disk (short for hard disk drive – hard disk).

Virtual memory is a memory management technique implemented using a combination of hardware and software. It maps memory addresses used by a program (called virtual addresses) into the real address in computer memory. The primary repository appears as a contiguous address space or set of contiguous storage segments. Windows then manages the virtual address space and assigns real memory to the virtual memory. The hardware devices responsible for translating addresses in the CPU are often referred to as the memory management unit (MMU). These hardware components automatically translate virtual addresses to real ones. Software within Windows can extend these capabilities to provide a virtual address space that may exceed the capacity of real memory.

The main benefits of virtual memory include helping to free up applications or by managing the amount of shared memory and increased security by segregation of memory.

Essentially, a pagefile is an area on the hard disk that Windows will use as if your actual RAM is not enough.

By default, Windows will automatically manage the pagefile settings for you, but sometimes you may need to manually manage your pagefile yourself. For example:

  • When the C: drive, where your Windows is installed is too small, you may want to move the pagefile away from that drive to another drive with more free space.
  • Once you’ve used a lot of memory, you’ll probably want to add a pagefile to another drive so it’s ready to use when needed.
  • If you don’t use a lot of memory while your pagefile is large, you will probably want to use a smaller custom size.
  • If you get BSOD PAGE_FAULT_IN_NONPAGED_AREA or KERNEL_DATA_INPAGE_ERROR or Low Memory type errors , you may need to use a larger custom size for the pagefiles.

This article will show you how to manage pagefile virtual memory for each drive on your Windows 10 computer.

Note: You must be logged into the system as an administrator in order to be able to make changes to the pagefile.

EXAMPLE: pagefile.sys on drive C: in Windows:

Manage virtual memory pagefile for all drives in advanced performance options

1. Start Control Panel and click the System icon

2. Under System , click the Advanced system settings link on the left and then close the System window.

3. On the Advanced tab, select Performance . Under Performance , click the Settings button.

4. On the Advanced tab, select Virtual memory, then click the Change button .

5. At this step, you will decide how you want to manage the pagefile on your drive (s). The available options include:

  • Custom size (step 6).
  • Delete (step 7).
  • System management (step 8).
  • Manage all systems (step 9).

6. Set the custom size for the pagefile on one drive

A) Uncheck Automatically manage paging file size for all drives.

B) Select the drive where you want to set the custom size or add the pagefile (for example drive C :).

C) Select Custom size.

D) Enter the minimum Initial size you want for the pagefile on the selected drive, this size is in MB (1024MB = 1 GB).

E) Enter the maximum initial size you want for the pagefile on the selected drive, also in MB.

F) Click the Set button.

G) Click OK

H) A dialog box will appear informing you that for the above changes to take effect, you must reboot the system. Click OK to confirm.

I) A next dialog box will appear. Click Restart Now to restart your computer, through which your changes will be applied.

7. Remove (disable) the pagefile on a drive

A) Uncheck Automatically manage paging file size for all drives.

B) Select the drive where you want to delete the pagefile (example: C :).

C) Select No paging file.

D) Click the Set button.

E) Click Yes to confirm.

F) Click OK.

G) A dialog box will appear informing you that for the above changes to take effect, you must reboot the system. Press ok to confirm.

H) A next dialog box will appear. Click Restart Now to restart your computer, through which your changes will be applied.

8. Set the size of the pagefile on a system managed drive

A) Uncheck Automatically manage paging file size for all drives.

B) Select a drive for which you want to set the system managed pagefile file size (eg drive C :).

C) Select the System managed size option.

D) Click the Set button.

E) Click OK to confirm the changes.

F) The next steps are the same as the two above.

9. Set the size of the pagefile on all system managed drives

A) Check the Automatically manage paging file size for all drives check box.

B) Click OK

Enable or Disable “Automatically manage paging file size for all drives” in Command Prompt

Turning on Automatically manage paging file size for all drives will delete any custom capacity set for the pagefile on all drives and the pagefile capacity is automatically managed by the system for all drives with pagefile.

1. Open Command Prompt as administrator.

2. Copy and paste the command below you want to use into the Command Prompt, and then press Enter.

  • Turn on (default) “Automatically manage paging file size for all drives”:
wmic computersystem where name=”%computername%” set AutomaticManagedPagefile=True

Or:

  • Turn off “Automatically manage paging file size for all drives”:
wmic computersystem where name=”%computername%” set AutomaticManagedPagefile=False

3. Now, you can close the Command Prompt.

Change the custom size of the pagefile for a specific drive in the Command Prompt

1. Open Command Prompt as administrator.

2. Copy and paste the command below into the Command Prompt, then press Enter to turn off “Automatically manage paging file size for all drives”.

wmic computersystem where name=”%computername%” set AutomaticManagedPagefile=False

3. Copy and paste the command below into the Command Prompt, and then press Enter. This will show you a list of drives with pagefiles, as well as their Initial sizes and their Maximum sizes in MB.

wmic pagefileset list /format:list

If InitialSize and MaximumSize are set to 0MB , it means it is currently managed by the system. You can change these capacities in the next step to get the custom size you want.

A list of drives with the pagefile listed

4. Enter the command below into the Command Prompt and press Enter.

wmic pagefileset where name=”<drive letter>:pagefile.sys” set InitialSize=<custom min size>,MaximumSize=<custom max size>

Replace <drive letter> in the above command with the actual drive letter (eg “C”) for the pagefile from step 3 for which you want to set the custom volume.

Replace <custom min size> in the above command with the custom initial (minimum) space you want, in MB (example: “16”) for the pagefile on the specified drive (example: “C” ).

Replace <custom max size> in the above command with the maximum custom size you want, in MB (eg “4985”) for the pagefile on the specified drive (eg “C”).

For example:

wmic pagefileset where name=”C:pagefile.sys” set InitialSize=16,MaximumSize=4985

5. Close Command Prompt.

6. Restart the computer to apply.

That is all information in today’s post. Good luck!

See more:

  • How to create a virtual machine repository for Hyper-V Quick Create
  • How to create and use Hyper-V checkpoints in Windows 10
  • How to import Hyper-V virtual machines in Windows 10
  • How to change default directory hosting Hyper-V virtual machine in Windows 10