What's the maximum amount of heap space that one can allocate for java on a 64-bit platform? Is it unlimited?
For 64 bit platforms and Java stacks in general, the recommended Maximum Heap range for WebSphere Application Server, would be between (4096M - 8192M) or (4G - 8G).
From the Java Tuning white paper: For a 32-bit process model, the maximum virtual address size of the process is typically 4 GB, though some operating systems limit this to 2 GB or 3 GB. The maximum heap size is typically -Xmx3800m (1600m) for 2 GB limits), though the actual limitation is application dependent.
Therefore we recommended that physical memory availability for each JVM be 4096 MB;0.5 GB is for JVM allocation and 512 MB is for overhead. This simplified calculation means that a 64-bit system with 16 GB physical memory can run 3 JVMs.
Sets the maximum memory size for the application (-Xmx >= -Xms). -Xmx size. size can be specified in megabytes (m) or gigabytes (g). For example: -Xmx2g sets a maximum heap size of 2GB.
Theoretically 264, but there might be limitations (obviously)
According to this FAQ it's only limited by memory and swap space on the local system:
On 64-bit VMs, you have 64 bits of addressability to work with resulting in a maximum Java heap size limited only by the amount of physical memory and swap space your system provides.See also Why can't I get a larger heap with the 32-bit JVM?
Also keep in mind you need to set the max heap via command line. Without an -Xmx command. without it Java uses 64mb + 30% = 83.2mb as a default max heap on 64 bit machines according the same FAQ.
java -Xmx1000g myClass
works fine on my machine. But it dosn't seem to yet support the 't' modifier so you can't specify max memory in terabytes yet :)
If you could make every atom in the universe into a byte of RAM, you could allocate it in a 64 bit address space.
Actually, that's a slight exaggeration.
There are 10^80 atoms in the universe (according to WolframAlpha), and 2^64 bytes of address space in a 64 bit system, so you'd only be able to address 1 out of every 5x10^60 atoms. But if you have 18 qintillion bytes of RAM, you'd probably need a couple of quantum black holes to power it with.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With