13

Years ago, I tried 64-bit JDK but it was really buggy.

How stable would you say it is now? Would you recommend it? Should I install 64-bit JDK + eclipse or stick to 32-bit? Also, are there any advantages of 64-bit over 32-bit other than bypassing the 4 GB memory limit?

user2348638
  • 133
  • 1
  • 1
  • 4
  • See this - http://stackoverflow.com/questions/3669778/why-should-i-use-the-64-bit-jdk-over-the-32-bit-version – Caffeinated May 03 '13 at 23:37
  • 1
    @Adel: That was in 2010. – user2348638 May 03 '13 at 23:37
  • 1
    The memory limit is not 4GB per process, but standard 2GB due to the way memory is mapped, on both Windows and Linux. Both OSes offer tricks to increase that limit, but it will never be 4GB (more like 3GB) – fvu May 03 '13 at 23:43
  • Are answers to this question possibly outdated? Any new recommendations? More and more both processors, operating systems and software are 64-bit. I imagine stability is no longer an issue, and perhaps even performance has changed. But we are not yet past the 32-to-64-bit transition, so the question is definitely still relevant and the answer not obvious. I would add to the question whether one needs to install both? (Or does that cause other problems?) – C Perkins May 17 '17 at 04:19

5 Answers5

11

Only begin to bother with that if you want to build an application that will use a lot of memory (namely, a heap larger than 2GB).

Allow me to quote Red Hat:

The real advantage of the 64-bit JVM is that heap sizes much larger than 2GB can be used. Large page memory with the 64-bit JVM give further optimizations. The following graph shows the results running from 4GB heap sizes, in two gigabyte increments, up to 20GB heap.

That, in a pretty graph:

32 bit vs 64 bit JVMs in performance

See, no big difference.

See more (more graphs, yay!) in: Java Virtual Machine Tuning

acdcjunior
  • 132,397
  • 37
  • 331
  • 304
5

I think the answer can be found pretty simple.

Answer the question: "Do I need more than 4GB of RAM?".

A 64 bit JVM is as stable as a 32 bit JVM. There are no differences. In fact a Java Application running in a 64 bit JVM will consume more RAM compared to a 32 bit JVM. All internal datastructures will need more RAM.

My eclipse is running in a 64bit JVM.

Christian Kuetbach
  • 15,850
  • 5
  • 43
  • 79
4

Are you going to deploy to a 32 or a 64 bit environment? If you're affinitized to an environment in production then your development environment should use the same environment type.

If you're platform agnostic, go with x64 and don't even think about it. The platform is mature and stable. It gives you tremendous room to scale up as you can just add memory and make your heaps bigger.

Nobody wants to tell a CEO, "Sorry, we chose x86 and can't scale up like we hoped. It's a month long project project to retest and replatform everything for x64."

Chris M.
  • 1,731
  • 14
  • 15
2

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

The 64-bitter uses 64-bit pointers. If you have 4GB+ RAM, and are running Java programs that keep 4GB+ of data structures in memory, the 64-bitter will accommodate that. The big fat pointers can point to any byte in a 4GB+ memory space.

But if your programs use less memory, and you run the 64-bit JVM, pointers in will still occupy 64 bits (8 bytes) each. This will cause data structures to be bigger, which will eat up memory unnecessarily.

Juned Ahsan
  • 67,789
  • 12
  • 98
  • 136
0

I just compiled a MQTT client in both the 32-bit JDK (jdk-8u281-windows-i586) and the 64-bit JDK (jdk-8u281-windows-x64). The class files produced had matching MD5 checksums.

FYI, it's perfectly safe to have multiple JDKs on your system. But if the version you use is important, you should be comfortable with setting your system path and JAVA_HOME to ensure the correct version is used.

Adam Howell
  • 415
  • 1
  • 11
  • 24