开发者

Why should I use the 64-bit JDK over the 32-bit version?

I use Eclipse and 64-bit Windows and develop Java desktop applications. So far, I have only used the 32-bit JDK, but is there any reason to change to 64-bit JDK for Java development开发者_StackOverflow?


No, for your development-time activities, 32 bits is likely to be enough.

The newest JVMs support pointer compression, but otherwise, the 64-bit version of an application requires more memory to run. Only use 64-bits if your application needs to address more memory (32 bits should address 4 Gb, but OS considerations sometimes make this less).

Besides wasting a bit of memory, a 64-bit version shouldn't be a problem, but anecdotally, all of the inexplicable crashes of the usually rock-solid JVM I hear complaints about are in 64-bit versions. It could be the OS or other factors, but if you don't have a reason for 64 bits, why push your luck?


The primary reason would be if you wanted to write an app capable of using a large amount of memory (e.g. over 4GB, or whatever the per-process limit on your operating system is).


Try this:

public class Benchmark {
    public static void main(String args[]) {
        long time = System.currentTimeMillis();
        for (int a = 1; a < 900000000; a++) {
            for (int b = 1; b < 20; b++) {
            }
        }
        long time2 = System.currentTimeMillis() - time;
        System.out.println("\nTime counter stopped: " + time2);
    }
}

In 32 and 64 bit and laugh at the difference.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜