Ugh, Java. :(
First I'll give you the short answer: Yes, I think this could be a valid reason to run without a page file, knowing of course that you'll no longer be able to generate system crash dumps, and your machine will crash or destabilize to the point where you wish it would have crashed if you run out of memory. However, you just have to weigh the pros versus the cons for yourself. Technically, Windows can run fine without a page file as long as you don't run it out of memory... barring old or poorly-designed applications that stupidly assume the existence of a pagefile, for example.
Now, the long answer.
First, why does paging happen? The operating system uses a page replacement algorithm, where every memory page is marked with an "age," which is a counter since the last time that memory page was accessed. Memory pages that haven't been accessed in a long time are eventually written out to disk, so that other potentially more important data can be given space in RAM. If a process actively uses its allocated memory more often, there is less of a chance of those pages being written out to the page file.
Application developers can call the VirtualLock
Windows API function to ask Windows to lock pages into the working set of the calling process. It requires a certain operating system privilege to be able to successfully call that function however, since having the ability to lock pages into RAM could potentially have adverse effects on the entire system if you don't play nice. But this doesn't help you, because VirtualLock
is something you would use in your code while you were developing an application. It's not something you can call on someone else's running process.
But with Java, now you are running a virtual machine with its own internal memory manager on top of the actual operating system and its memory manager, and those two don't always work well together, as you are experiencing. Locking a process (or more accurately, locking all of the memory allocated by a process) into physical memory is operating system-specific, and as such, is not something that would be handled by Java, since Java strives to be agnostic and cross-platform.
So, the only way I know of to get Java to lock its allocations into RAM so that they don't get paged out, is to use JNI (Java Native Interface) and mlock()
/mlockall()
.