Thursday, March 6, 2008

JVM Max Heap Size on WinXP 32-bit

I have been trying to run some memory intensive java program on a WinXP Pro system with 2gb of RAM. Unfortunately, I could never reserve more than 1.4gb of memory on it for the JVM heap (using -Xmx). Frustrated, I turned to a 32-bit Linux server on Fedora Core 5. To my surprise, I managed to reserve 1.8gb. It appears that on 32-bit systems the maximum one can reserve is slightly less than 2gb and because of OS constraints, different OSes (hence different JVMs) have different limits on max heap size. WinXP Pro only allows from 1.4gb to 1.6gb. Anything more than 2gb requires a 64-bit machine as stated in Sun's FAQ here.

No comments: