adam bien's blog

The X-Files (actually -Xmx files), reloaded. 📎

I got interesting feedback for my last post about the -Xmx and windows issues, with many links to external resources. First of all,  32bit applications on windows are limited to 2GB RAM. This limit can be raised to 3GB, however some settings at OS-level are required. This is just a fact, and has nothing to do with Java. This article covers the issues and settings in great detail.

Some JVMs, like JRockit, allow more heap, than 1.6GB - 1.85GB, or 2.85GB in particular, however the memory is partitioned (fragmented) in this case. So the performance of the allocation, as well as garbage collection, could degrade. The "trick" with /3GB switch is also mentioned for the IBM JVM.

The -Xmx switch is somehow dangerous as well. Too high setting causes the JVM to "crash" (actually not to start), with the following message:

"Invalid maximum heap size: -Xmx4g
The specified size exceeds the maximum representable size.
Could not create the Java virtual machine
."

So the proper -Xmx configuration is a crucial for all Rich Internet Applications, which are installed or deployed vie WebStart etc. In this case the lowest common denominator is crucial... On most machines there should be no problem with configuration below -Xmx1.4g. Fine tuning could be dangerous, especially if you are responsible for user support :-). On the server the issue is less a problem - the "try and error" strategy works well. However only in view companies I know the servers run on windows...:-)