Click to See Complete Forum and Search --> : using more than 4 gig of memory in Java


eshbach
07-29-2005, 04:02 PM
I'm writing a data analysis program on a 64-bit SPARC/Solaris system. The program needs to use about 8-12gig of memory at a time. The machine has 32gig in it, so that shouldn't be a problem, but Java won't let me create a VM with a max heap size bigger than 4gig. anyone know how to do this?

edit: for clarification i am running with the following commands:

java -d64 -Xmx12G

RenegadeMike
07-30-2005, 04:40 PM
Try running Java with the following options:

-server -Xms6g -Xmx6g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=90 -XX:+CMSParallelRemarkEnabled

You may need to use the latest Java 1.5.0 release. The CMS garbage collector had some bugs in 1.4.1/2 that you might run into. Anyway, the CMS collector can deal with bigger heaps a lot better, so it will probably work.

Those settings (for 6G heap) have worked for me on Linux with AMD64, so I imagine they will work on something better like Solaris too :)

rock
07-30-2005, 10:25 PM
You'll want to benchmark with and without the -server flag if those options don't require it. In some cases it's faster (by quite a bit), but sometimes it's slower too, so it's worth testing if it is an option.