13 November 2007

IntelliJ IDEA JVM Options on MacOS X



I hunted for this for a while to find this, so I figured I'd post it to save others some time in locating it. If you have a need to change the JVM options for IntelliJ IDEA on MacOS X, take a peek in this plist:


<IntelliJ IDEA install location>/Contents/Info.plist


I had to change the memory options for the JVM and Chris gave me some other options to improve the garbage collection performance. Here's what I have in the VMOptions field:


-Xms128m -Xmx768m -XX:MaxPermSize=120m -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:+AggressiveOpt -XX:+UseBiasedLocking -XX:+DoEscapeAnalysis -Xbootclasspath/p:../lib/boot.jar -ea


One option tells the JVM to do escape analysis which performs some additional optimizations on your code. Some info on escape analysis in the Java VM is available in yet another excellent article by Brian Goetz titled, Java theory and practice: Urban performance legends, revisited. If you're at all curious about the internal workings of the Java Virtual Machine, this article is well worth the time it takes to read. I'm also telling the JVM to be more aggressive with its optimzations using the AggressiveOpt option. I'm also using biased locking which improves performance for uncontended synchronization as explain in the Java Tuning White Paper.

As always, YMMV (your mileage may vary).

2 comments:

  1. Great tip, thanks. It seems to make a huge difference in performance.

    Putting the options in as is didn't work for me, however. IDEA 7.0.1 crashed hard on startup. I narrowed it down to the

    -XX:+UseBiasedLocking

    option. Removing that made everything work great.

    ReplyDelete
  2. Was trying these for intellij 7.0.4 on windows. 2 of the options gave an unrecognised VM option: '+AggressiveOpt' / +DoEscapeAnalysis'

    I was hoping they would help my execution time, which takes so much longer via IDEA rather then when run via JBoss...but they did not help that.

    ReplyDelete