简体   繁体   English

为什么我要在32位版本上使用64位JDK?

[英]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. 我使用Eclipse和64位Windows并开发Java桌面应用程序。 So far, I have only used the 32-bit JDK, but is there any reason to change to 64-bit JDK for Java development? 到目前为止,我只使用了32位JDK,但有没有理由改为使用64位JDK进行Java开发?

No, for your development-time activities, 32 bits is likely to be enough. 不,对于您的开发时间活动,32位可能就足够了。

The newest JVMs support pointer compression, but otherwise, the 64-bit version of an application requires more memory to run. 最新的JVM支持指针压缩,但是,64位版本的应用程序需要运行更多内存。 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). 如果您的应用需要寻址更多内存,则只使用64位(32位应该解决4 Gb,但OS考虑因素有时会减少这一点)。

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. 除了浪费一点内存之外,64位版本应该不是问题,但有趣的是,通常坚如磐石的JVM的所有莫名其妙的崩溃我听到的抱怨都是64位版本。 It could be the OS or other factors, but if you don't have a reason for 64 bits, why push your luck? 它可能是操作系统或其他因素,但如果你没有64位的原因,为什么要推动你的运气?

主要原因是如果您想编写一个能够使用大量内存的应用程序(例如超过4GB,或者操作系统的每个进程限制)。

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. 在32位和64位并嘲笑差异。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM