We have an unsupported 3rd party reporting application, (Panscopic’s Scopeserver running under Tomcat), that has started having out of memory errors when running very large reports. Long term, we’re looking for a replacement, but short term I’m wondering if I can upgrade the underlying Java run-time environment to 64 bit. We’re currently running under a 32 bit version of Java on 64 bit MS Windows with 12Gb RAM.
Given that Java compiles to byte-code and the run time environment enables that code to run on a variety of platforms,
• Will Java .class files compiled under a 32 bit version of the compiler run under a 64 bit version of the run time environment?
• If the software runs, is it likely that Out-Of-Memory problems might go away, at least until we hit 64 bit limits?
Unless your application uses some native code (eg. via JNA or JNI), the Java application should run the same on the 32 bit and 64 bit JREs. You definitely can use the same .class or .jar files.
You won't hit any 64 bit limit any time soon. You might, however, find out that when run on the 64 bit JRE the application uses more memory, the reason is that the pointers Java internally uses take more memory - theoretically 64 bits instead of 32, but the JRE might perform some operations to shrink the pointer size (at the price of some small performance hit). It would be a good idea to run some tests before you make this change in production.
With a 32-bit JRE, the Java heap space is limited to around 1.5GB (by Windows, this limit exists for all 32-bit applications). With a 64-bit JRE this limit does not exist, so you can use -Xmx to allow Java to use more memory than that 1.5GB. (At work, we've used up to 14GB without any problems.)
Ronald James wrote:• Will Java .class files compiled under a 32 bit version of the compiler run under a 64 bit version of the run time environment?
There is no difference in the bytecode produced by the Java compiler included in the 32-bit JDK and in the 64-bit JDK. Java bytecode is not 32-bit or 64-bit, like native code. (Since the Java compiler itself is written mostly in Java, it's in fact the exact same compiler). It doesn't matter if you compile your code on a 32-bit or 64-bit JDK - it will run on any JVM.