I tried to use -Xms and -Xmx options to specify the JVM heap memory size,
but have a few questions. It would be appreciated if someone could help.
I'm using Widows 2000.
Q1: the system has only 351MB extended memory and 640KB system memory, but I
could use -Xms497109865 (more than 480MB) and Xmx66000000 (almost 640MB) to
start the JVM and a Java application. Why I can specify heap size more than
physical memory without a failure?
Q2: can I use -Xms460m and -Xmx2g to specify 460MB initial heap and 2GB max
heap memory size, in stead of using -Xms460000000 or -Xmx2000000000?
Q3: I used "mem" command on a DOS window to check the available memory size.
But it seems the available memory size doesn't change at all no matter what
values used with -Xms. I assumed the available memory size should be
smaller if a higher values is used with -Xms because JVM take more memory.
Is my assumption wrong?
Q4: where can I find a doc with thorough discussion on how to use -Xms
and -Xmx options?
Thank you.
Lee
Windows is using virtual memory system, a huge disk file extends the physical
memory
<<
Q2: can I use -Xms460m and -Xmx2g to specify 460MB initial heap and 2GB max
heap memory size, in stead of using -Xms460000000 or -Xmx2000000000?
>>
I believe not
<<
Q3: I used "mem" command on a DOS window to check the available memory size.
But it seems the available memory size doesn't change at all no matter what
values used with -Xms. I assumed the available memory size should be
smaller if a higher values is used with -Xms because JVM take more memory.
Is my assumption wrong?
>>
DOS window is using its own memory set from the virtual memory. You must use
task manager (CTRL ALT DEL and select it) performance tables for memory usage
information)
> Q1: the system has only 351MB extended memory and 640KB system memory, but
I
> could use -Xms497109865 (more than 480MB) and Xmx66000000 (almost 640MB)
to
> start the JVM and a Java application. Why I can specify heap size more
than
> physical memory without a failure?
The JVM has limitations by itself and if your settings are bigger than the
limits, it only takes its limited values without mentioning anything.
However the behaviour is different under different platforms and different
JVM-Releases, my expierence under solaris 8 is, that the JVM only takes 1
GB.
Also consider, that Windows has a Virtual-Memory, that is almost twice
bigger than the physical memory.
> Q2: can I use -Xms460m and -Xmx2g to specify 460MB initial heap and 2GB
max
> heap memory size, in stead of using -Xms460000000 or -Xmx2000000000?
I don't know if 'g' has been defined, but i know you can
use -Xms460m -Xmx2048m
> Q3: I used "mem" command on a DOS window to check the available memory
size.
> But it seems the available memory size doesn't change at all no matter
what
> values used with -Xms. I assumed the available memory size should be
> smaller if a higher values is used with -Xms because JVM take more memory.
> Is my assumption wrong?
Use the Task-Manager instead of mem.
In the Process-Tab you can configure to see the memory used for every
process.
> Q4: where can I find a doc with thorough discussion on how to use -Xms
> and -Xmx options?
No idea..
Maz
Thanks for the info. It helps a lot.
Since Windows is using virtual memory system, then memory assigned to JVM
by -Xms, -Xmx should be also in virtual memory system, then heap in a JVM is
also in Windows virtual memory space. Is it right?
Thanks.
Lee
"Gilgames" <gilg...@aol.coma> wrote in message
news:20010421095513...@ng-ck1.aol.com...
Thank you for the info. It helps a lot.
If you don't mind, could you please give me more hints to the following
questions.
Q1: do Linux and Solaris use virtual memory space like Windows OS?
Q2: since JVM is only a local application on Windows, Solaris or Linux, so
the location (in physical memory or virtual memory) of the heap inside JVM
totally depends on the OS. Is this statement right?
Q3: Java's Runtime.freeMemory() and Runtime.totalMemory() only show heap
memory size inside the JVM (not the PC's), and they both are in virtual
memory space on Windows. Is it a right statement?
Thanks.
Lee
"hotmaz" <hot...@gmx.de> wrote in message
news:9bvn1b$mqm$07$1...@news.t-online.com...
> Since Windows is using virtual memory system, then memory assigned to JVM
> by -Xms, -Xmx should be also in virtual memory system, then heap in a JVM is
> also in Windows virtual memory space. Is it right?
Yes. This is also an important cause of Java slowness, since the GC
needs to se practically all of the heap at once. Thus you have one
virtual memory manager (CG/heap) running in another (the Win32 VMM),
which is a recipe for disaster. :-)
The solution is usually to have more than enough RAM.