• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

32 bit JRE vs 64 bit JRE

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to CodeRanch, Ronald!

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.
 
Sheriff
Posts: 22815
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.)
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
PI day is 3.14 (march 14th) and is also einstein's birthday. And this is merely a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic