Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java JDK 32 bits vs 64 bits

I am creating a quite simple application which reads and display text files and search through them.

I am asking myself if there is any interest for me to propose 32 and 64 bits version to the user.

Is the difference only in having access to more memory heap size with the 64 bit version or is there any other interest ?

Will a 32 bit compiled program work on a 64 bits JVM (I assume yes)

like image 442
HpTerm Avatar asked Jan 16 '12 13:01

HpTerm


2 Answers

The only differences between 32-bit and 64-bit builds of any program are the sizes of machine words, the amount of addressable memory, and the Operating System ABI in use. With Java, the language specification means that the differences in machine word size and OS ABI should not matter at all unless you're using native code as well. (Native code must be built to be the same as the word-size of the JVM that will load it; you can't mix 32-bit and 64-bit builds in the same process without very exotic coding indeed, and you shouldn't be doing that with Java about.)

like image 99
Donal Fellows Avatar answered Sep 28 '22 18:09

Donal Fellows


The only times that have swung it for me is when there have been native libraries involved that have pushed it one way or the other. If you're just in Java land then realistically, unless you need >4GB of heap size, there's very little difference.

EDIT: The differences include things like it uses slightly more memory than 32 bit, significantly more if you're using a version before 6u23 and aren't using -XX:+UseCompressedOops. There may also be a slight performance difference between the two, but again nothing huge.

like image 31
Michael Berry Avatar answered Sep 28 '22 17:09

Michael Berry