Technology in terms you understand. Sign up for the Confident Computing newsletter for weekly solutions to make your life easier. Click here and get The Ask Leo! Guide to Staying Safe on the Internet — FREE Edition as my thank you for subscribing!

What Is Pagefile.sys? Can I Delete It?

Mysterious, hidden, and sometimes large.

pagefile.sys
(Screenshot: askleo.com)
Pagefile.sys is the "paging file" that contains Windows' virtual memory. You can easily remove it -- if you understand the ramifications.

Pagefile.sys is a file created by Windows to manage memory usage.

It takes special steps to remove it, but it’s not difficult. I have instructions.

The catch: you probably don’t want to.

Become a Patron of Ask Leo! and go ad-free!

TL;DR:

pagefile.sys

Pagefile.sys is the Windows paging (or swap) file used to manage virtual memory. It’s used when a system is low on physical memory (RAM). Pagefile.sys can be removed, but it’s best to let Windows manage it for you.

Pagefile.sys

Pagefile.sys is the Windows paging file, also known as the swap or virtual memory file. Virtual memory is disk space used by Windows when it runs out of physical memory, aka RAM.

When programs on the computer use a lot of RAM — perhaps even trying to use more than the machine actually has — some of its contents are written to the paging file. If the “paged out” memory is needed again, other RAM contents are written to disk — again in the paging file — and the previously-written information is read back in.

It’s where Windows juggles and keeps track of demands for a lot of memory.

Note that pagefile.sys is a “system” file. In order to see the file in Windows File Explorer, the option to “Show hidden files and folders” must be enabled, and “Hide protected operating system files” must be disabled.

Since the file is being used by Windows, even when it’s not actively paging memory, you can’t just delete it.

It’ll either tell you “permission denied”, “file in use”, or something similar. Extra steps are required.

Playing with virtual memory

You may notice pagefile.sys is roughly the same size as your configured virtual memory settings. That’s a clue.

This leads to our first way to get rid of it: set your Virtual Memory to zero, and reboot. Once you return, Windows will no longer be using the file, and will let you delete it. (You may need to use an administrative command prompt to do it.)

If you have enough RAM in your system to handle the amount of memory needed to run the programs you use, you may not need virtual memory at all. I often run with no virtual memory configured, and no pagefile.sys present on my drive.

Note, however, that pagefile.sys will return if you re-enable virtual memory.

Playing with a different operating system

The other approach to deleting pagefile.sys is less useful, but I’ll include it to be complete.

Boot into another operating system and delete the file.

If you boot from a Linux “Live” DVD and explore your Windows hard drive, you’ll find, and should be able to delete, pagefile.sys.

We’ve done exactly what you asked for, but there’s a problem.

As soon as you boot Windows, as long as you have virtual memory enabled, pagefile.sys will return.

My recommendation:  let Windows manage the file

Unless you have a reason to adjust your virtual memory settings or know you can run without virtual memory at all, I suggest leaving the settings, and pagefile.sys, the way they are. Given today’s large hard disks, the amount of space taken by pagefile.sys is generally small in comparison.

Now, hiberfil.sys, on the other hand, might be worth removing. Those instructions are here: What Are Hiberfil.sys and Pagefile.sys, and How Do I Remove Them?

Do this

Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.

I'll see you there!

Podcast audio

Play

44 comments on “What Is Pagefile.sys? Can I Delete It?”

  1. Hello Leo,

    You mentioned that you don’t have a pagefile.sys file or to put in a different way you have disabled virtual memory. Are there any performance benefits to be achieved by doing so? Given that I have 2GiB physical memory and at most all my processes end up using not more than 500MiB, what would be ramifications of disabling virtual memory altogether?

    Regards.

    Mostly it just frees up a chunk of disk space (and provides a little security for people concerned about what might be written to their pagefile). If the system isn’t using it the performance impact is negligible.

    – Leo
    30-Dec-2008
    Reply
  2. Hello leo. im reading your stuff so much time now.
    u great. i have a question. from what size of Physical RAM i can disable the VM? casue i my C drive is small and i need that extra space (3069MB – Fixed Size). My PC have 2GB DDR2 800MHz CL5 Physical RAM.
    TNX!

    There’s no one answer – it depends on how you use your computer. If the programs you run regularly use less than your total RAM, then you can probably get rid of VM. If you run programs that end up using more memory than you have RAM, then VM (or more RAM) is required to avoid “Out of Memory” situations at the cost of some speed.

    – Leo
    30-Dec-2008
    Reply
  3. I often defrag and before I do so I set the system to no paging file and reboot, then I defrag and then reset the system to allow Windows to set the paging file size again and it overwrites the previous pagefile,
    In this way I feel that I am defragging the area of disk taken up by the page file which otherwise would not be defragged.
    I hope that this is a sensible idea.
    Just another way of dealing with pagefile.sys rather than just letting it sit there.

    Reply
  4. I seem to remember reading somewhere that either Windows or some programs do expect to “see” some sort of page file on the “C” drive (even if it’s only a small one) and I recollect that the recommendation in the article I read was to have a token small one on the “C” drive, even if (as I have done) the main page file is put on a second drive, which is supposed to improve performance.

    Reply
  5. Hi Leo, re: VM. Have you seen a case where the a desktop’s motherboard and HD seem to be incompatable and this results in VM messages about being out of VM no matter how VM is configured? I finally gave up on the friend’s computer but it’s bugged me ever since. My guess was a computer shop replaced the HD with the wrong type but the situation wasn’t one where I wanted to do it again. Really appreciate your site and insight. Thanks for the help….mike

    Nope, never seen that. And I’d expect a different more serious error message if there was an incomptibility of some sort.

    – Leo
    01-Jan-2009
    Reply
  6. Had to use the CD boot once to fix a 98 boot pagefile corrupted error. Worked perfectly.
    Occasionally had to delete NT pagefile for tweeking performance. Setting VM to zero is a neat trick I’m glad to know.

    Reply
  7. I recall reading in a Microsoftie’s blog something about Windows expecting to be able to potentially write, at minimum, the entire contents of RAM to the pagefile — not in relation to the hibernation file, but rather to some internal Windows processes. I believe the post in question referred to Windows XP specifically, and I don’t honestly expect Vista to behave any differently in this regard.

    Furthermore, considering that even with 2 GB of RAM in my computer I’m seeing a commit charge (pagefile usage) or 932 MB, I’m loath to suggest its deletion when Windows clearly is using it.

    Unfortunately, all I have is a potentially false memory and anecdotal evidence. Plus, I’m certain that Windows will still work without a page file, it’s just that I’m of the impression it will not work as well (either BSOD-ing more often, or just performing (paradoxically) worse) as the same install with a page file.

    As such, feel free to disregard this comment.

    As I mentioned, I run without a page file. Windows XP with 4 gig RAM. It’s been as solid as XP gets, and that includes running things like World of Warcraft, Adobe PhotoShop, Sony Vegas (video editting), and more. Often even accidental combinations of the above, just because I forgot to shut something down. :-)

    And I don’t believe “commit charge” is actually VM usage. As I said, I have no VM, and as I type a commit charge of 1.2gig, which actually matches current RAM usage.

    – Leo
    31-Dec-2008
    Reply
  8. I see! Indeed, checking it again, it seems the commit charge is the sum total of all memory (physical + virtual) usage.

    And, what’s more, the so-called “Page File Usage” graphs on the Performance tab of Task Manager seem to follow the commit charge, so… in conclusion, I’d like to slap whoever set the labels on those two graphs, ’cause they did it wrong.

    Reply
  9. I can remember having a WinME computer that keep giving me “hard drive C: write errors”, which I eventually solved by deleting the page file. Must have been corrupted.

    With XP, as I understand it, it may be a security risk since it can have saved passwords, usernames, and other sensitive data.

    Here are two ways to have it deleted at shutdown, a clean one will be recreated at start up.

    Clearing the Page File on Shutdown

    Click on the Start button
    Go to the Control Panel
    Administrative Tools
    Local Security Policy
    Local Policies
    Click on Security Options
    Right hand menu – right click on “Shutdown: Clear Virtual Memory Pagefile”
    Select “Enable”
    Reboot

    For regedit users…..
    If you want to clear the page file on each shutdown:

    Start Regedit
    Go to HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerMemory ManagementClearPageFileAtShutdown
    Set the value to 1

    http://www.geocities.com/terryhollett2003/

    Reply
  10. I read somewhere that the pagefile is where a memory dump is performed if a system failure would occur, like a bluescreen or the likes. My gaming computer got 12GB ram (64bit OS of course and, yeah, what was I thinking getting that much..). Anyway would there be any reasons like the memory dump example to keep the pagefile, or is it usefulness purely to act as additional ram?

    Reply
  11. Dear,
    I tried both & both setting is same as u suggested above. But still i cant decrise the size of pagefile.. Kindly suggest me on my mail ID..

    Thanks & regards;

    Harshit

    Reply
  12. i read on another site to delete pagefile.sys: turn off (VM) reboot then delete pagefile.sys, then turn on (VM) again and ‘click’ “set”. i did this but when i looked in C:pagefile.sys it was the exact size before i deleted it? (3,712,272) did i do something wrong ?

    Reply
  13. One use for the delete/recreate cycle is to trade in a fragmented pagefile for a contiguous one. If the old file has grown and fragmented (perhaps as a consequence of increasing RAM), and (through defragmentation) you’ve got enough clear space for the entire pagefile, this trick will work. Or, you could buy an expensive defragment utility to do this explicitly. Usually a contiguous one-piece pagefile will provide better performance.

    Reply
  14. I think its volume changes whenever I let my laptop be off for a while about a few hours.
    Is it possible? Suppose I have something about 3 gigabyte hidden and I turn the laptop off. After a few hours being left off, its free space turns back.
    Is this my illusions?

    Reply
  15. Your second delete suggestion has a great use – when pagefile.sys gets infected with a virus. My antivirus is having issues removing it. Now that I know how to manually remove it, I’ll fix the problem myself. Thanks!

    Reply
  16. As a note to deleting from another OS like a Linux Live CD:

    This could be a good option for someone who has an infected pagefile.sys. Some viruses can hide out in there, so successfully deleting it from another OS can be useful (even though windows will create a fresh version on next boot)

    Reply
  17. i have a dell latitude D610 laptop several weeks ago I started to get all these error messages and security messages telling me my pc was infected with a virus and gave me a number to call I call the number and wound up paying 149.00 to have it remotely repaired. this package also came with mcafee which was another 99.00. but thats when my pc really started to act up. one of the most overwhelming was when i went on line Firefox my current browser would open up multiple tabs without any in put from me. it then would take me to websites that i also didn’t request. and from there problems seem to get worst with error messages popping up and when i did have the fortunate luck to go to a website that i had search for it would be covered with ads from other websites to the point that I could n;t read the website that i had went. to. I have the beta version of fire fox and when i did a trouble shooting app. the results would say that version of Firefox was incompatible with windows 7.

    Reply
  18. In an ideal world, some users may not need a page file. But random, unexplainable things sometimes happen. Yesterday, I looked at task manager too see why my computer was slow. When I sorted by memory to see why it was at 88% (for reference, this system has 6 GB of RAM), I noticed that the “system” process was using more and more memory every second. I closed all my programs out, and the memory usage was still going up. I had to reboot.

    Reply
    • That type of behavior is making me think that you may have malware running or possibly a virus, as some virus’ have shown to eat up resources on a PC. Leo has a link just a couple of posts above this. That link to another article by Leo has many good procedures to check out your PC with. I would recommend checking with all of them to help ensure that your PC is clean. Can take some time to run through all of them, but you should then know that malware or a virus is your culprit or if it lays somewhere else.

      Reply
  19. What would cause a user to have a 68 pagefile.sys files on their computer harddrive? If you buy a new used computer, but put your old harddrive in it, would that cause another pagefile.sys file to be created? If you buy a new used computer and copy your old hard drive to that previous owned harddrive, would you have the previous user’s pagefile.sys now on your harddrive? Trying to figure out if the pagefile.sys files follow the hard drive or the computer it is installed in.
    I have just never seen, pagefile.sys_1 through pagefile.sys_68 on a computer before. I thought windows could only handle up to 16 pagefile.sys and normally you only have one.

    Reply
  20. When using forensic tool kit on a pagefile.sys, will you see any timestamps in the pagefile.sys of when a file was created or deleted?

    Reply
  21. Nice, spare commentary that’s understandable even to those of us who didn’t really take to the computer ‘lab’ in 1976 (my running joke was to tell my addicted friends that there was no future in computers anyway, so why waste all that time learning assembly language? pffft…)

    Pagefie.sys brought me here. I have a chronic issue that’s plagued me through three PCs, perhaps simply because I chronically keep too many browser-tabs open as I pursue scattered issues & interests. I don’t shut down unless forced to; generally that means some serious performance problem forces me to restart. Anyway, on a clean install of Windows, I can go for months or maybe a year or more before this browser-choking thing happens: I sit down with coffee in the AM and start to catch up on email or the NYT, etc., and after I open one or two emails (5-10 seconds of normal performance), Chrome has a virtual stroke. Looking at Task Manager or Resource Monitor, I’ll see see “disk usage” pegged at 100%. This may go on (if I don’t power-off) for fifteen minutes or so – after which performance returns to normal.

    I don’t know how to peg what’s going on through taskman or resource mgr, but it usually appears that Chrome is using the bulk of disk active time. Often, some pagefile.sys operation will pop to the top of the Resource Monitor list. Is there anything to be done about this, short of rebooting often?

    Reply
  22. How about hiberfil.sys? If I never hybernate, do I need to keep it?
    Thanks for all your work. You have helped me tremendously over the years.
    Brian

    Reply
  23. Leo, I’ve read about page file a number of times. It recently occurred to me that I may have been one of it’s inventors, a very very early inventor without knowing it. Le me explain.

    Out of college in 1961 joined IBM. After training I wound up in Poughkeepsie NY. In the outskirts was a company called Delaval Seperator Company which made equipment for the farm milk production business. We sold them an IBM 1401 system with 4K of memory. (In those days 16K was a large memory) I helped them write programs for their accounting apps. One app just could not fit down to 4K. So I figured out the subroutines that we needed and wrote them separately so they could fit out on their disk drive, an early concept then. When the subroutine was needed it was read into a small space I saved in the memory, large enough for the largest routine. It worked! In 1962!

    Reply
    • That’s close and very cool, but not quite the paging file. Paging is all about actively writing volatile RAM to disk. in addition to paging, Windows does indeed do exactly what you did — reads only those portions of a program (.exe, .dll files) into RAM as needed. But the paging file isn’t actually involved. Exactly which it does (reads portions from program files, discards those portions, writing data to the paging file, and so on) is part of Windows incredibly complex memory management that I’m not sure any one person really understands completely. But, yeah, extremely innovative for 1962, for sure. :-)

      Reply
  24. My C: drive is filling up, and I’d like to free up some space. I noticed that the directory C:\I386 and all it’s subdirectories take up well over 800 megabytes. Can I move that to my D:\ drive where I have much more room? Or better yet, can I delete it?

    Reply
  25. Is this still current information? If my antimalware program tells me it didn’t scan C:\pagefile.sys, and also not swapfile nor hiberfil, because none of these exist, should I be concerned and should I service my machine or try to get any of them back?
    It really doesn’t do memory very well.
    Thanks.

    Reply
    • The article still applies. I’m sure that the file exists, but I’m also sure that anti-malware tools can’t scan it because it’s constantly in use. I’d have to know WHAT antimalware program you use, and the EXACT text of the error message to be able to say more.

      Reply

Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

I want comments to be valuable for everyone, including those who come later and take the time to read.