Intellij IDEA freezes up, even when editing a .txt file

mmm picture mmm · Sep 29, 2014 · Viewed 19.4k times · Source

When I return to intellij, sometimes just to edit an already open .txt file, Intellij would freeze and I get pissed at waiting for 3-4 seconds.

Sometimes, in Java files this happens all the time. And I would have to restart Intellij. Autocompletion is sometimes a ****.

I have a super computer, ala NSA, no just kidding, but it is a powerful beast, and Intellij properties have been altered:

-server
-Xms2048m
-Xmx4096m
-XX:MaxPermSize=2048m
-XX:ReservedCodeCacheSize=2048m
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Djsse.enableSNIExtension=false
-XX:+UseCodeCacheFlushing
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=200
-Dawt.useSystemAAFontSettings=lcd

Various plugins have been disabled, including hg4xxx.

What is the dealio? I am on Intellij 13

Answer

Javaru picture Javaru · Sep 30, 2014

I would recommend dropping your memory settings down. When memory options are set too high you get pauses due to garbage collection and other memory management issues. Over the years in the BSO days (Before StackOverflow), the JetBrains IntelliJ IDEA forum routinely had some post an issue with brief hangs that ended up being solved by them dropping their memory settings down. At one point, IDEA even opened a warning popup on start-up if the more than 700MB of memory was allocated.

For the past 7 years of 10 years of IDEA usage I have run IDEA using:

-Xms128m
-Xmx724m
-XX:PermSize=128m
-XX:MaxPermSize=384m
-XX:ReservedCodeCacheSize=96m

And I frequently have numerous large projects open and have no performance issues. With that said, a recent change to the scala plug-in (at least for the EAP version of IDEA 14) suggests increasing both -Xms & -Xmx to 2048m. I've only just implemented that myself yesterday. So I need to see if it causes any issues.

If changing memory settings does not resolve the issue, I would recommend disabling all third-party (i.e. non-bundled) plug-ins to ensure that is not an issue. (They often are.) If that resolves it, you can track down which particular plug-in is causing the issue.

Another culprit that can cause this issue is anti-virus software. IDEA uses a lot of cache and index files that are updated frequently. JetBrains recommends you add the IDEA system and config directories from anti-virus real time monitoring. See Directories used by the IDE to store settings, caches, plugins and logs for their locations.

In regards to the pauses upon frame reactivation, you may want to turn off File > Settings (Ctrl+Alt+S) > [IDE Settings] > General > Synchronization > Synchronize files on frame deactivation. Usually it's not a problem to have this turned on. But on some systems it might cause an issue. Be aware however if you routinely edit project files outside of IDEA, you need to be more cautions and manually run a File Synchronization when you return to IDEA.

If after that the issue persists, I recommend you take a CPU and Memory Snapshot (as outlined in the linked document) and submit them to JetBrains.