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

843829
Are you by any chance running on a dual processor machine? If you are, you might be running with -server (this is the new ergonomic change in Tiger), and with a larger default heap size. The best way to check this is to run
java -showversion myClass
A new feature in Java5 was to determine if the machine was better off using -server instead of -client (>2cpu, >2gb of memory). If that was true then -server is used and certain GC tuning parameters are specified. If the VM detects you are on a "Server Class" machine, than by default 1/4 of your memory is used as maximum heap up to a maximum of 1gb. So its possible that's what you are hitting.
843829
You are right, this may be the problem.

Is there a way to change the default behavior or do I always set -server/-client manually to make shure my favorite java vm gets started?
843829
You can continue to use the server VM if you wish, but just remember to specify minimum and maximum heap sizes with -Xms and -Xmx.
1 - 3
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
932 views