I have a system with a large amount of memory. Right now, to prevent a single application from paging, I've disable the paging file completely. The issue that I'm running into is that I cannot maximize memory usage for the single process I care about. I want to disable paging for a single process so that it never pages out, and it can use most (95%?) of the memory; all other process should be able to page out. Right now we end up using ~%80 of the available memory with the disabled paging file, but we know that we don't care about those processes being sent to the paging file. This is not an open-sourced program that I'm running, so I cannot modify the code to use other .NET/Windows calls to prevent the paging myself.

I think on Linux this is called "swappiness".

  • You aren't using more ram because the app isn't asking for it. In fact you are likely hampering performance because stale data can't be paged out to make room for cached data. See serverfault.com/questions/74822/… for details on windows memory management. Biggest takeaway should be that windows pages IN not out. Page faults occur when there wasn't enough memory available to keep the page in memory so I had to get the data from disk (usually DLLs first) – Jim B Aug 11 '15 at 4:32

You can't tell the O.S. to keep a process data in memory; the process can do it itself if it has the "lock pages in memory" right, but it must request it explicitly in code; otherwise, Windows will page out as it deems appropriate.

If you completely disable the page file, Windows will just reserve some memory for itself, and will start to deny memory allocation requests when too much memory is already in use.

If you leave the page file enabled (as you really should), you have absolutely no control on what and when will be paged out.

Anyway, you should have better trust in the memory manager: its job is to page out unused/unneeded data, and if a process is actively accessing its memory there are very little chances it will be paged out. Unless, of course, memory usage is so high that the system just can't cope with it; but if this is the case, then you really should look into adding more memory to the box.

  • This is somewhat incorrect. Removing the page file does not stop the paging process, nor will it deny memory allocation until either the working set exceeds physical ram (just like it would with a page file), or memory becomes too fragmented to serve the request. As long as there is data stored on disk windows can page it in as required for page faults. – Jim B Aug 11 '15 at 4:24
  • I was a bit simplifying, of course; but the point still stands: trust your memory manager, and if you really have memory issues, then add more actual memory; Windows is going to do its best to optimize memory usage, and there isn't any possible performance benefit in disabling the page file in a misguided effort to make the system behave as you think it should. – Massimo Aug 11 '15 at 6:00
  • I don't disagree my comment was directed at the paging process and the idea that removing the page file has any effect whatsoever on the actions of the memory manager, it simply limits the available pages. – Jim B Aug 11 '15 at 13:46
  • We currently have 1TB of memory in the box, and even though we could add more, we are looking to see all of our options. I'm not 100% certain how Windows' memory manager handles things, but when some of the data that we have loaded into memory is paged out/in because of another process, it becomes painful if we need to use that chunk of memory again. Since the application we are using is used in many high performance computing systems, I'll see if there is an option to "lock pages in memory". – EGr Aug 11 '15 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.