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:
The more the better…
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.
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.
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.