Piotr Gabryanczyk’s Blog

Java, Refactoring, AOP, Spring, DDD, TDD, etc.

  • Blogroll

    • I have joined Anti-IF Campaign

IntelliJ and Garbage Collection

Posted by Piotr Gabryanczyk on December 12, 2006

I recently read the article about garbage collection (here) and decided to tweak my IntelliJ settings.

I am using IntelliJ 6.0.2 and JDK 1.5.0_08.

I ended up with the following settings:


Let’s explain them:

Heap size


The more the better…

Perm size

IntelliJ likes a lot of memory for caching references and class meta information. That is why we need to make sure that cache is not purged. Cache is stored in “Old Generation” space which size is determined by the following option


200m is good for the size of project I am using. General rule is to observe memory indicator after using find symbol option with include non project files selected. If it doesn’t move you have chosen enough memory.

Maximum Pause


We ask GC to pause the application for no more then 10 milliseconds.

Proportion of free space


We ask GC to kick off when more than 30% of memory is occupied, so when we start compilation GC will not interfere because it will be enough memory free.

Concurrent Mark-Sweep (CMS) Collector


We want GC to run in parallel with other threads without freezing the application. This option doesn’t stop GC from freezing the application but it reduces it significantly.

Incremental Mode


We don’t wont to freeze the application so we do GC incrementally with breaks so the application can take a breath. We use Pacing so GC can learn how to use CPU based on application CPU usage.


21 Responses to “IntelliJ and Garbage Collection”

  1. Stephen said


    I thought you were an Eclipse user 🙂

    Seen this? http://blogs.jetbrains.com/idea/2006/12/boosting-intellij-idea-performance-on-windows-systems/

    I was going to try it at home tonight…if Anya will let me. She doesn’t always let me at the computer when I get home, for good reason 🙂

    Hope all is well,

    Btw — have you seen this as well? I haven’t played w/ it yet but it looks pretty good…

    Just won the plugin contest

  2. piotrga said

    Hi Steve!:)

    I am an Eclipse user at work, and IntelliJ user in my other live 🙂 I some times use it at work as well, if they let me :))

    Acctually the NTFS optimization hint is really cool! I will definitelly apply it.

    I have downloaded DBHelper, it looks interesting.
    I will be watching its development.

    Have you seen this http://plugins.intellij.net/plugin/?id=949 ? 🙂
    Here is the code http://code.google.com/p/intellij-plugin-eclipse-integration/source

  3. Stephen said

    Nice work! i’ll take a look

    I wrote my own plugin, but never bothered posting it to http://plugins.intellij.net/, it’s on my java page http://www.anya-and-stephen.com/pages/java.jsp

    I’ve also created another handy idea plugin…I’ll publish it when I find the time 🙂

    You know what would be cool?
    a. a keyboard mapping converter that allows you to use IntelliJ shortcuts in eclipse and vice versa
    b. Eclipse RCP integration plugin for IntelliJ

    Talk to you later

  4. Slava Pestov said

    Why should an IDE need 512Mb of memory?

  5. piotrga said

    Hopefully it wont need 512M, but I like my IDE to be extra responsive and give it more memory in case it needs it.
    In practice I never reached 256M limit with IntelliJ.

  6. Sanjiv said

    I’m using the same versions of IDEA and JDK but when I start IDEA with the settings you suggest, IDEA rewrites idea.exe.vmoptions to just have


  7. piotrga said

    Sanjiv, how do you know that IDEA rewrites the settings?
    On my machine… 🙂 it doesn’t.

    Are you using EAP? I don’t think yjpagent is a part of the standard distribution.

  8. Sanjiv said

    I know IDEA is rewriting the settings because as soon as I start IDEA, the file gets updated. I’m on 6.0.2 Build #6083 (nov 2nd).

  9. Ashish said

    You need to modify the file “inspect_diff.bat” and the line
    “IF “%IDEA_JVM_ARGS%” == “” set IDEA_JVM_ARGS=-Xms450m -Xmx700m -Dsun.java2d.noddraw=true”

  10. […] by Piotr Gabryanczyk on June 26th, 2007 IntelliJ 7 was a bit unstable with JDK 1.6 on previous set of options I presented on this blog so I decided to tweak it […]

  11. Idris said

    You can also use -Dsun.awt.keepWorkingSetOnMinimize=true to fix the bug where it does not render for a few seconds on window activation

  12. AnferTuto said

    Hola faretaste

  13. Greg said

    BTW, the way you adjust the VM options depends on which version of IntelliJ you’re using and on which OS.


  14. Usman said


    I am new to IntelliJ and using the version 7.0.3. I adjusted my vm options using the properties mentioned in idea.exe.vmoptions file. But these changes are not reflected in my IntelliJ. I even restarted my IntelliJ as well as machine but without any success. Can anyone please guide ??

  15. […] IntelliJ and Garbage Collection […]

  16. Gallardo said


  17. eljunior said

    I recommend leaving initial heap size equal to the maximum: -Xms512m -Xmx512m.
    This way the GC won’t have to stop the JVM to allocate more memory every now and then.

  18. […] GKelly’s SO answer and Piotr Gabryanczyk’s blog entry for more details about the new […]

  19. […] GKelly’s SO answer and Piotr Gabryanczyk’s blog entry for more details about the new […]

  20. […] GKelly’s SO answer and Piotr Gabryanczyk’s blog entry for more details about the new […]

  21. […] 3. https://piotrga.wordpress.com/2006/12/12/intellij-and-garbage-collection/ […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: