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!

Disabling maximum Java heap size

843829Sep 28 2005 — edited Sep 28 2005
Unless someone can convince me otherwise, I'd like to completely disable the maximum heap size. I only want to get an OutOfMemoryError when the underlying OS (Windows in my case) has no memory left!

Is there a way to do this? Or do I have to do something like java -Xmx1688207360, which is the biggest value I can use on my box without getting

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

The reason I want to do this is that I use a lot of DirectByteBuffers, and now the JVM keeps track of how much it's using and will throw an OutOfMemoryError should I attempt to exceed this limit.

So I have to use either the -Xmx option or the -XX:MaxDirectMemorySize to increase these settings, and I'm trying to come up with a limit when really the only limit I can perceive is the physical limitation of the server.

The software will be running on server class machines with no less than 1GB of physical RAM.

I don't even understand the motivation for having a maximum heap size?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 26 2005
Added on Sep 28 2005
3 comments
1,063 views