2

Possible Duplicate:
Maximum Java heap size of a 32-bit JVM on a 64-bit OS

We have a 64 bit Linux server running the 32 bit JVM. We do not want to upgrade to 64 bit JVM for various internal reasons. What is the maximum -xmx value that would work assuming my OS can use way more than a 32 bit program can use?

Is it exactly 4096 or is there some padding where it has to be lower?

Community
  • 1
  • 1
benstpierre
  • 32,833
  • 51
  • 177
  • 288

1 Answers1

1

3788.8 MB is the max heap size for a 32-bit JVM on a 64-bit Linux. Source: http://pauldone.blogspot.com/2008/08/is-jvms-maximum-heap-size-really-17-gb.html (For older Java so might actually be more or less for Java 6)

Robert Louis Murphy
  • 1,558
  • 1
  • 16
  • 29
  • Well the first google search for linux highmen max memory lists [this](http://lists.samba.org/archive/linux/2005-November/014555.html). `For a 32 bit process on a 64 bit kernel (a common case on ppc64 or x86_64) the limit will usually be (4GB - one page).`. I don't see any reason why the kernel would need to reserve 1gb of virtual memory out of the processes address space when it has TBs of space free. – Voo May 17 '12 at 18:23
  • @Voo - Remember, he asked about heap size, not the size of the JVM process. The heap size is the amount of RAM available to the Java application running in the JVM and therefore the heap size does not include the RAM being used by the JVM itself. – Robert Louis Murphy May 17 '12 at 18:25
  • Yeah so we're obviously have to subtract a few hundred mb. Still as your own link shows, the available heap memory for a 32bit process under 64bit OS is certainly larger than 3gb (also the same argument would've applied to "can use 3gb" anyhow). +1 for the link now. – Voo May 17 '12 at 18:27
  • @Voo - Your are correct, so I corrected my answer, thanks for the feedback. – Robert Louis Murphy May 17 '12 at 18:31
  • Note that there is a version of the "32-bit" IBM JVM (32-bit object references) which can handle about 60GB of heap. (It does this, of course, by running in 64-bit mode but using 36-bit references where only the high-order 32 bits are stored.) – Hot Licks May 17 '12 at 18:37
  • 1
    Be careful with using the max possible. The heap is only one part of the memory used by Java applications. You should monitor well, as the Java application also needs space for the threads and to store classes objects/interned strings etc in the permanent generation. Also take GC into consideration (however pauses should not be that long for a small heap) Use `jmap -heap` on the command or use jconsole/jvisualvm to monitor the optimal size. Also – raphaëλ May 17 '12 at 19:07
  • @HotLicks would you happen to have a link? – Thorbjørn Ravn Andersen Jul 11 '13 at 09:51
  • @ThorbjørnRavnAndersen -- Can't find a link offhand -- would take some searching. The JVM is known as "J9", though, if that helps. – Hot Licks Jul 11 '13 at 11:42