Memory setting algorithm
I am having what sounds like the same issue described here in a number of posts as well as a couple of referenced youtrack issues. The symptom is IDEA hangs.
I actually have been having this issue since 8, though less pronounced in 8 and far less frequently.
Which got me to thinking whether it is my memory settings. I generally have 2-3 large projects open at the same time and frequently run intellij for days, so the default memory settings were nowhere near adequate.
So is there an algorithm or guidelines from JetBrains in regards to how to properly define the memory settings for intellij?
Currently I run on a machine with 2GB of RAM and dual cores @2GHz each running Fedora 12 (KDE). So plenty of "umph". My current intellij memory settings are:
-Xms256m
-Xmx1024m
-XX:MaxPermSize=300m
-ea
It takes forever (according to the little memory monitor) for it to reach mx of 1024m. What I see instead is lots of time spent at the current max heap size bumping into it and presumably running GC, and then immediately running back up to the same level. Not sure how much stock to put in that little monitor...
Anyway... Are those settings "good"? If not, is there such a guide for setting?
请先登录再写评论。
try removing the -Xms setting.
I know this goes against all the usually accepted notions of JVM memory settings. But I was recently talking to Kirk Pepperdine(http://kirk.blog-city.com), a relatively well-known perfomance expert in the Java world. I asked him about the value of setting -Xms as a default. He said that unless you have a good reason to think it will improve perfomance do not use it. He explained that the -Xms will change the garbage collection and memory allocation behaviour of the JVM.
I do not have enough evidence yet that not setting -Xms helps but I have adjusted many applications I use regularly accordingly and have not seen any degradation... also I was prompted to ask Kirk this question since I have often seen that different -Xms settings affect garbage collecting behaviour(frequency of call for example) a lot, without neccessarily helping with any other issues.
I run IDEA with '-Xmx2048m -XX:MaxPermSize=250m' running 1-3 projects with 3-7 module each and 10'000+ classes per project. I rarely see the memory go over 1gig.
cheers,
Florian
Thanks for the response Florian. I guess I did not even consider that setting-Xms would shape the garbage collector but it makes sense. Anyway I just changed my settings and we'll see how these new settings (using your settings) work out.