Maximum 32-bit JVM heap size 2GB?

Maximum 32-bit JVM heap size 2GB?

Is the maximum heap size for 32-bit JVM 2GB? some people say it's 1.2GB, 1.5GB, 2GB, etc. Who is right? If you search internet, you may encounter different numbers as well.

max heap size in JVM is defined in the -Xmx of the JAVA_OPTS parameter, e.g. java -Xmx1024m

Here's what I understand:


·         Theoretical max heap for 32-bit is 2^32 = 4Gb; similarly 64-bit is 2^64

·         Operating system has limit to each process, e.g. 2Gb for Linux process, which will create an upper bound for the JVM heap

·         In real practice, there are other JVM internal overhead that uses the heap, and thus we cannot assume the full 2Gb

·         If you define max JVM heap = 2048m, and you only have 2Gb physical memory on your Linux server, it's likely that your application or JVM will crash due to memory issues (from real production experience)

Rule of Thumb from Field Experience


·         Set max JVM heap size to 1.2Gb if you run 32-bit JVM on 32-bit Windows XP / Vista, though you can stretch to 1.4Gb or 1.6Gb. For example, Fortify Source Code Analyzer can take 1.4Gb but crash on 1.6Gb or above if scanning large code base that consumes lots of memory.

·         Engineers who are familiar with Hotspot JVM on Solaris may have the perception that the max heap size limit is on the physical memory, or the limit is only on 32-bit Windows. It's possible that the context may be they are running on 64-bit Solaris with default 64-bit JVM.


Reference
This blog lists the process's memory upper bound for 32-bit and 64-bit OSs.
http://pauldone.blogspot.com/2008/08/is-jvms-maximum-heap-size-really-17-gb.html

 



This e-mail and any attached files are confidential, proprietary, and may also be legally privileged information, and are intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient of this e-mail, please send it back to the person who sent it to you and delete the e-mail and any attached files and destroy any copies of it; you may call us immediately at + 91 22 6643 8000 or email us at IT-Security@tatainteractive.com

Tata Interactive Systems and/or any of its sister companies owns no responsibility for the views presented in the e-mail and any attached files unless the sender mentions so, with due authority of Tata Interactive Systems.

Unauthorized reading, reproduction, publication, use, dissemination, forwarding, printing or copying of this e-mail and its attachments is prohibited.

We have checked this message for any known viruses; however we decline any liability, in case of any damage caused by a non-detected virus.

For more details about our company, visit http://www.tatainteractive.com.

Comments

Popular Posts