Reputation: 634
My virtual memory won't go higher than 2GB when I has 8GB available.
I'm running Ubuntu 10.10 x86 with Java JRE 1.6_25 installed.
When I try to launch the .jar file, it just an instantly crash.
It works just fine when I set the VM to 2048M
These are the arguments I use to define the VM -Xmx4096M -Xms4096M
Thankful for any help :)
Upvotes: 1
Views: 2747
Reputation: 75356
You should strongly consider migrating to a 64 bit operating system if you need that large a Java program. This will allow you to use a 64-bit JVM which allows for larger-than-2Gb Java programs.
I am not aware of a procedure to easily migrate from 32-bit to a 64-bit Ubuntu, but you can save your home directory and then reinstall.
You can then easily install the OpenJDK Java and with a bit more effort the official Sun JDK.
Upvotes: 0
Reputation: 206689
If that's a 32bit VM, you won't go higher than 2G (or close to 3G with a kernel configured for 3G/1G userspace/kernel address space split). There is no way to have a 32bit process use more than 2G (or 3G with the right settings) of real memory.
You'll need a 64bit kernel and JVM to reach 4G of heap space (and go much beyond that).
See this question for good info about memory limits on Linux for 32bit applications: Memory limit to a 32-bit process running on a 64-bit Linux OS.
(The accepted answer talks both about 32bit and 64bit kernels. It also suggests that there were some patches where you could nearly reach 4G for userspace on a 32bit kernel, but I don't think those kind of things ever went into Ubuntu kernels - kind of a nich server thing.).
Upvotes: 6