问题
We are developing a swing application written by Java which requires only about 128MB memory, and in the short future I don't see it will require much more memory like 4GB. Previously we provide always 3 different releases, one for 32-bit Windows, one for 32-bit Linux and another for 64-bit Linux, with an installer which has JRE included. The 64-bit version was not used by anyone until couple of weeks ago, and an OutOfMemoryException was reported because the application consumes about 40-50% more memory than the 32-bit version.
My question is, is it needed at all for us to provide the 64-bit version for 64-bit Linux if the application will never need to use more than 4GB memory? We had some quick test which revealed that 32-bit version works also on 64-bit Linux. But I'm not sure what could be the cons we would have, e.g. performance and/or compatibility issue?
回答1:
check this 64 bit java
回答2:
If your application provides no improvements for 64-bit host operating systems and is compatible with your 32-bit releases then I see no immediate need to provide it.
However, most, if not all new system are based on x64 architecture where I advocate that also 64-bit software should be the natural default. This needs grows stronger the closer you get to hardware level. I can't tell you how awkard it is to run a virtual operating just to support some 32-bit VPN client.
Promoting the 64-bit client would probably impact your download statistics if you would decide to make it the preferred choice.
回答3:
Most 32-bit JVMs are limited to around 1.2-1.5 GB.
If you find your application uses much more memory with 64-bit JVM, try the -XX:+UseCompressedOops
which tells the 64-bit JVM to use 32-bit references but can still access 32 GB of memory.
回答4:
My question is, is it needed at all for us to provide the 64-bit version for 64-bit Linux if the application will never need to use more than 4GB memory?
If the application won't ever need that much memory, 64 bit installer / JVM adds no value. On the contrary, it is a poor option because (as you observed) it simply uses more memory and (probably) runs slower as a result.
(Actually, the actual limit will be less than 4GB. Some parts of the 32-bit address space will be unusable, because of hardware architecture issues.)
I suggest you withdraw the 64 bit version, but provide the user with the ability of using a JVM that they have downloaded and installed separately. (Indeed, you should probably do the latter anyway. Embedded copies of the JRE tend to get overlooked when people upgrade to get the latest JVM security fixes ...)
UPDATE (2019) - Java 8 is the last version of Java which Oracle provides for 32 bit platforms. As of Java 11 (the current LTS version), the Oracle-badged distributions for Linux, MacOS, SunOS / SPARC and Windows are 64 bit only.
My advice now would be to migrate your product offerings away from 32 bit as soon as you can. You don't want to be stuck trying to support a product on an EOL'd version of Java.
Granted, 32-bit Java 11 is available from Azul, according to this Q&A. (I noted 32 bit "Zulu" releases of Java 11 for Linux, but not for Windows or MacOS. YMMV.)
来源:https://stackoverflow.com/questions/5178598/32-bit-or-64-bit-application-on-64-bit-os