The other day when doing some particularly large xslt conversions I kept running out of memory in the JVM. After doing a bit of research I found two command line arguments that help solve the problem. -mx allows you to set the maximum size of the memory allocation pool while -ms allows you to set the starting size.
For example:
java -ms50M -mx1000M ProgramThatNeedsLotsOfMemory
will execute ProgramThatNeedsLotsOfMemory with a starting memory allocation of 50M and let it grow up to 1GB. You can also use K to specify the memory size in kilobytes, but I’m not sure why that would be useful unless you are on a machine with very little memory.
After looking into the documentation a little more it appears that the new syntax for these commands is -Xms and -Xmx, so you’ll have to choose the one that works depending on your version of the JVM.