The simple fact is, you should have the pagefile enabled, although you can disable it you can't fully prevent the OS from using a pagefile.
While a paging file is beneficial, it is by no means necessary. If you disable the paging file, it really is disabled. Windows can run perfectly fine without one. The role of the paging file is so the system can write pages on the modified page list, which represent pages that aren't being accessed actively, but have not been saved to disk, out to the paging file. If there is no paging file, those pages won't be written out to disk. While this will result in less memory being available, Windows isn't going to function any differently.
What has to be taken into account though is related to the system commit limit. When a process allocates certain types of virtual memory, the allocation gets charged against the commit limit. Windows is making you a commitment that it will be able to back that data by physical memory, or store it on disk in a paging file. The limit is therefore the sum of physical memory (or most of), plus the size of the paging file(s). When you hit the system commit limit, processes won't be able to allocate the virtual memory they want and will fail to run correctly.
You can monitor the system committed virtual memory usage of the system with a tool like Process Explorer. The information will be shown under the 'Commit Charge (K)' section of the 'Memory' tab.
Commit Charge (K):
- Current - This represents the amount of committed virtual memory processes have currently allocated which must be backed by physical memory or stored in the paging file.
- Limit - This represents the amount of committed virtual memory processes can allocate at any one time and is the sum of most of physical memory and the size of the paging 'file(s).
- Peak - This represents the total amount of committed virtual memory processes have allocated since the system booted which must be backed by physical memory or stored in the paging file.
Whether you can disable the paging file or not is going to primarily depend on how much system committed virtual memory your workload requires in relation to the amount of physical memory of the machine. If you have enough physical memory to support your workloads system commit, you can theoretically run with no paging file. For example, your machine has 4GB of physical memory, and your workload requires 2.5GB of system commit.
However, there are a couple of disadvantages by having no paging file. Firstly, modified pages that could be written to the paging file (and then subsequently moved to the standby page list where they can contribute to 'available' memory) will be forced to stay on the modified page list, and therefore, taking up space in memory. Secondly, the system won't be able to generate crash dumps.
One other thing which is worth mentioning, because it can be a problem, is regarding certain applications failing to run because the paging file has been disabled. If we assume the issue isn't due to the fact that the user is hitting the system commit limit, which may give the illusion the application requires a paging file.
There are certain applications, Dawn Of War II being an example, which genuinely won't run if the paging file has been disabled. The reasoning behind this though isn't because a paging file is necessary, but based on that very misconception.
Mark Russinovich said:
These apps could very easily be querying directly for the existence of a paging file and failing if one’s not present, based on the misconception that one is necessary.
If you're going to have a paging file, and would like to size it yourself, to find out how large it needs to be on your own system, take a look at the peak commit charge after you have attained your maximum workload. The difference between that value and the amount of physical memory of the machine is the size of the paging file which you will need to be able to run your workload.
For instance, if your machine consists of 4GB of physical memory, and your workload requires 5GB of system commit, you would need a paging file of at least 1GB to support it. This should be the bare minimum for the initial size of the paging file. You would want to add extra onto that value to give yourself some breathing room. If you are interested in crash dumps, make sure it's large enough to accommodate them as well. For the maximum size, you could double what you have set the initial size value too.
Personally, I am of the firm believer that you should manually set the page file for min and max to be the same size. This will stop the pagefile from being fragmented.
If this is something that concerns you, even though the paging file is able to expand and contract, it will only do so if there is a demand for it. The paging file will grow when the current commit charge nears the commit limit, which will mean the limit will also grow. It will grow right up and till the paging file has hit it's maximum size, assuming there is a demand for it. As long as the initial allocation is sufficient, the paging file will never need to grow, and the maximum simply serves as a safety net.
Edit - Rearranged the layout of the post to make it slightly clearer.