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

前端 未结 3 2017
轮回少年
轮回少年 2020-12-14 02:28

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 dev

相关标签:
3条回答
  • 2020-12-14 02:38

    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 讨论(0)
  • 2020-12-14 02:41

    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?

    0 讨论(0)
  • 2020-12-14 02:51

    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).

    0 讨论(0)
提交回复
热议问题