I have to allocate a large amount of memory in java appl., but I noticed
that operating system (windows xp) move large parts of heap from ram to
page file.
Does anybody know how can I avoid paging in java?
Thanks in advance
Java doesn't do the paging; the underlying OS handles that.
--
Steve W. Jackson
Montgomery, Alabama
Java allocates virtual memory from the OS. The OS back
that virtual memory with physical memory and page file.
It is not a Java problem. It is an operating system
problem.
I don't think WinXP really limits a processes RAM usage, so
maybe there are two many and too big processes for the
available RAM ?
Arne
There is - run it in Linux or add more RAM or stop running the other programs
on the same box.
OK, only the first option actually forbids Win XP to swap the JVM's RAM. The
others can help, though.
--
Lew
I think there is some magic you can do - but note that it will not be
portable to other OSs.
Take a look at the KeepResident plugin for eclipse:
http://suif.stanford.edu/pub/keepresident/
This shows you how to do it.
Windows is over-zealous about paging out because it thinks its better to
keep memory for disk buffer cache than for your large (in Windows terms)
badly behaved JVM.......
Dave
If you have sufficient physical memory (2GB or more) you could
just disable paging at the OS level. I routinely run my 2GB
desktop and laptop with paging turned off (paging file size == 0).
I do the same thing.
Even though I never exhaust physical RAM, I've noticed that disabling
the page file on Windows results in a huge performance increase.
Linux doesn't seem to have this problem.
As someone else said, Windows is very aggressive about swapping
out application code in favor of I/O buffers, while Linux
uses a more sane approach. In linux you can actually control
the 'swappiness' of the system as a whole (but I can't remember
the parameter right now).