Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Default Xms and Xmx setting for java?

843829Jan 19 2006 — edited Jan 23 2006
Hi,

according to the docs for linux (and solaris) (http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/java.html) the default Xms and Xmx settings are 2M and 64MB.

I tried this on a virtual server with kernel memory limits:
$ java Hello
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
I thougt that this errore were due to the kernel memory limits, so I tried to reduce the memory:
$ java -Xmx24M Hello
This worked, so I slowly increased the memory limit
$ java -Xmx32M Hello
Ok.
$ java -Xmx48M Hello
Ok.
$ java -Xmx64M Hello
Ok. - Isn't this the DEFAULT value???
$ java -Xmx80M Hello
Ok.

I figured out that the critical limit is about 110 MB on my system.

So my question again: what ARE the default values for the Xms and Xmx settings?

Comments

843811
Such optimization are done by JIT compiler (not by javac).
C++ have just the same problems, exceptions make CFG analisis more difficult but not impossible.
PS You can read JLS about volatile variables there some additional restrictions on them.
843811
zhmur is right, this makes optimization harder not impossible.

There are sicentific papers aimed at making more analysis/optimization in the presence of many try/catch blocks. For instance, JIT can reorder statements, and then put compensation code into the catch body, recovering program state back if an exception was thrown.

General principle is simple: exceptions are rare. So JIT optimizes the "normal" control flow by the cost of more complex catch body.

You may also look/post to the comp.compilers newsgroup regarding compilers and optimization techniques

Denis

-----------------------------
www.excelsior-usa.com/jet.html
High-Performance JVM for J2SE
1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 20 2006
Added on Jan 19 2006
3 comments
881 views