title: What is the largest possible heap size with a 64-bit JVM?
body: <p>The theoretical maximum heap value that can be set with <code>-Xmx</code> in a 32-bit system is of course <code>2^32</code> bytes, but typically (see: <a href="https://stackoverflow.com/questions/2457514/understanding-max-jvm-heap-size-32bit-vs-64bit">Understanding max JVM heap size - 32bit vs 64bit</a>) one cannot use all 4GB.</p>
  
  <p>For a 64-bit JVM running in a 64-bit OS on a 64-bit machine, is there any limit besides the theoretical limit of <code>2^64</code> bytes or 16 exabytes?</p>
  
  <p>I know that for various reasons (mostly garbage collection), excessively large heaps might not be <em>wise</em>, but in light of reading about servers with terrabytes of RAM, I'm wondering what is <em>possible</em>.</p>