Summary of useful Java commandline memory use options

Post date: Oct 21, 2012 5:48:47 PM

I found a great summary of useful Java command-line options to get the best use of memory and other tuning options.

Take a look at http://randomlyrr.blogspot.ca/2012/03/java-tuning-in-nutshell-part-1.html

The author has a good summary syntax diagram:

Another good article on when to use the different Garbage collection settings:

http://www.petefreitag.com/articles/gctuning/

I ended up using the following for my typical desktop apps:

  • My laptop with only 2GB of RAM available
    • -Xms768m -Xmx768m -XX:PermSize=128m -XX:MaxPermSize=128m -XX:ParallelGCThreads=2 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC
  • My Quad core workstation with LOTS of memory - 16GB
    • -Xms1600m -Xmx1600m -XX:PermSize=128m -XX:MaxPermSize=128m -XX:ParallelGCThreads=4 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC
  • Running jEdit on my My Quad core workstation with LOTS of memory - 16GB. allows for huge memory use if needed and full GC
    • -Xms1600m -Xmx5120m -XX:PermSize=128m -XX:MaxPermSize=256m -XX:ParallelGCThreads=4 -XX:+UseParallelOldGC

Different choices are needed for server applications:

The articles linked above have good discussion of server needs.