CLion on Mac is a CPU hog

Has anybody noticed that? It seems to be very busy "parsing syntax" all the time, but even when minimized, Activity Monitor shows it takes between 92% and 200% of my CPU! that's with the latest 1.2 EAP, but even 1.1 has that behavior... On laptops, it's really bad, the battery goes very quickly. I barely have any plugins installed. Is there anything else I can do to get the CPU consumption back into normal range?

Thanks!

Frank

2
53 comments

Could you please capture CPU snapshot and attach it to a new bug report? You can do it via Start CPU Usage Profiling and Stop CPU Usage Profiling actions.

1

I'm having the same problem on my MBP running Yosemite. After importing a project, it seems that every 10 minutes or so, it pegs all the CPU cores, runs the fan, gets very hot, and runs down the battery. This is even if I'm doing light -- or no -- editing. There's no feedback on what it's doing, but it's as if it has to scan and analyze the whole code base every several minutes.

I will get a CPU trace as you suggested.

Bug filed as https://youtrack.jetbrains.com/issue/CPP-4612

0

I'm trying to gather the CPU data as requested, but I can't figure out how to do it.
I can't find a .vmoptions file anywhere to edit, as suggested here: https://intellij-support.jetbrains.com/hc/en-us/articles/206827577-Reporting-performance-problems
And there is no "Start CPU Usage Profiling" option anywhere that I can find.
I'm on a Mac, using the evaluation version.
Can you give more specific instructions for how to get a CPU snapshot?

0

Figured it out. I was never able to get it working from my ~/Library/Preferences, but I did get the menu item after editing the /Applications/CLion.app/Contents/bin/clion.vmoptions

I will file a bug report.

0

Yes, this is unfortunate. CLion has a lot of great features, but my 2013 MacBook Pro started running really hot twice while using it. At this point, for me, it's just not worth the risk.

1

Any update here? There was another thread talking about the same issue somewhere, but I can't find it anymore. I've seen some posts hinting at the fact that it could be happening because of symbols parsing and syntax highlighting, but not sure. Any kind of reply from JetBrains at all?

0

This seems to be pretty normal in general.  It happens to me in Linux as well.  My guess is it's just a java thing.  Java isn't really know for efficiency or speed.  I can definitely feel the difference in java programs vs c/c++ ones.  My cpus get pegged all the time with clion.  I've seen it up over 400% (have a 6 core/6 HT system) so that is pretty impressive load for an ide. ;)

There is a low power/low cpu mode you can turn on but it disables a LOT of features.  If you are concerned with cpu usage or battery life you can toggle that on.

As for heat on macs I find they like to not spin up their fans as much as possible.  If you are concerned get something like smcfancontrol (I think that's the name, been a while since I ran macs full time) and turn your fans up manually.  It will be louder of course but keep the heat way down.

0

Well, I don't want the heat or the noise, so messing with the fan isn't really a solution. And I want to be able to run on battery power for a long time.

But I'm very intrigued by the "low power mode" you mentioned. Is this a feature of CLion? Where do I find that option, and is it something I can easily turn on and off in a session? (For example, go back to regular mode when I know I am doing things that require re-analysis, but keep it in low power mode when I'm just editing or looking over the code?)

0

It's a clion thing.  It kinda makes it pretty meh with regards to a lot of the features of clion though.  You don't get any code parsing so refactoring, traveling to other symbols etc, all kinda stops working.  At least the last time I tried it.  But that may be ok with you for what your needs are.  Anyway, here is a screenshot showing you the setting:

Untitled.png

Click on that little guy icon on the bottom right of your status bar and that window pops up.. You can then click "Power Save Mode" to turn it all down or you can lower your highlight level to syntax which will help quite a bit but not take away everything.

1

That doesn't sound like a good resolution to this problem. I tried Eclipse, and it doesn't have that problem. I didn't do a detailed comparison of features, but it does provide syntax highlighting and navigation to keywords without requiring 400% CPU. There is no reason CLion couldn't do the same.

0

See I find Eclipse super slow too.  Coming from something like SlickEdit you really feel the speed differences.

On my systems (granted I run really high end systems) the cpu only goes high for a few seconds when it needs to reindex things.  Under normal usage I don't get those high cpu usages.  It is definitely way high cpu usage for an IDE.  I don't see that with other IDEs I've used.

But, that being said, I love CLion.  It is new so it has some issues, but it is a fantastic IDE.  Before this the only other IDE I used regularly was SlickEdit.  Most of the time I used VIM with some plugins to do some IDE type stuff.  Never really cared for most ides, until this one.  It does so much and helps me develop faster for sure.

I haven't run it on a mac but my boss does as do a few other developers at work.  None of them have reported major CPU issues, so you may have an issue with something that they aren't seeing.

0
Avatar
Brendan LE GLAUNEC

Yo.

Having the same problem as you on a 13" MacBook pro (but not on my 15" MSI) I tried to find ways to limit CLion's CPU usage, since when he decides to index the 50 000+ lines of code of the project while I'm building it, the computer freezes completely for at least 10 minutes.

The solutions I found were to use the commands nice and cpulimit (I'm working in a Linux environment, not MacOS) but CLion seems to bypass those limits.

If anyone finds any kind of way to prevent CLion from taking all the computer's resources, other than disabling Inspections (the only reason I use CLion), I'd be glad to hear about it!

I'll keep you up to date if I find anything useful.

0

I think you're kinda stuck with nice to manage the resource usage.  If you nice the main clion process all sub processes should inherit the nice level.  You can also renice the process in top or some other system monitor as you notice resource issues.

One of the big things is resetting your build jobs.  By default clion will make with a -j12.  A good rule is to use # of cpus or #cpus +1 for make jobs.  Even my hardcore workstation is only running with 6 cpus (12 with hyper threading but those don't count).  So a -j12 on a large project is super aggressive.  You can lower that down (per project even) to like a -j2 or something.  Your build times will suffer a bit.  If you wanted, limit it to a single one of your real cores (or at least leave a core for other stuff).  So if you have a 4 core, do a -j3.  That will leave plenty of cpu for your OS and responsiveness.

Also, depending on your flavor of linux, make sure you have preemptive desktop enabled in your kernel.  If you are in server mode there is no priority given to user interface stuff so it feels "locked up" a lot.  Most linux distros will have that enabled (if they are meant for desktop machines).  Some like the one I run (gentoo) is a power user source based distro.  It leaves kernel building and config up to the user.  So just make sure that is enabled in your kernel.  If you are running something user friendly like ubuntu it will almost assuredly be enabled already.

And lastly you can beg jetbrains to rewrite their stuff in a fast language like c++ instead of java so things are way way faster and you don't get massive cpu usage during indexing. ;)

Oh and it's possible since your mac is a lower end laptop you may have a super slow hard drive which could be more of an issue than the cpu during indexing and such.  If you don't have at least a 7200rpm sata drive that would definitely cause some slow days and locked up feeling.  Best would be to get an SSD for your main drive and store large data like videos/music/etc on another mechanical hd.

0
Avatar
Permanently deleted user

Are there any updates? I have the same issues on a Macbook Pro 2016. It is so bad that i have to switch to vim again. It seems as clion is always indexing/parsing or whatsoever. I have all plugins disabled except the terminal

3
Avatar
Permanently deleted user

Still looking for update.  It's so prohibitively bad that my typing is actually lagged, none of the features work in a timely manner, and using it without being connected to a power supply is out of the question.  Running a 2015 i7 Mac with El Caption.

2
Avatar
Permanently deleted user

Performance appears to have degraded for me with the 2017.1 version - how can I provide a debug log?

0

I see similar issues --  100-400% CPU utilization while (constantly) re-indexing on version 1.2.5. This is happens even if the *only* activity I do is a bit of editing! Environment is linux OS [Redhat RHEL6], host is x86_64, I7 with 16GB RAM.

0
Avatar
Permanently deleted user

I'm on 2017.3 EAP and the CPU usage is always >> 100 % consumed by CLion. Even if I'm away from keyboard. Jetbrains can do better. 

0

I am running 2017.2 on a 2017 Macbook Pro.  CLion routinely takes 400% CPU.  In case it helps, features that may be correlated are:

* Refactoring of variables (this can really grind sometimes)

* C++ debugger

I am happy to provide logs or information so Jetbrains can determine the root cause.  It seems Jetbrains just is not interested.  It is so bad I am considering swithing IDEs.  Its strange that I do not see this with Pycharm.

0

Hi all! Investigation of situations when CLion is unexpectedly slow or/and CPU usage is unexpectedly high requires some additional information from you. Each time you face such an issue, please don't hesitate to let us know by sending a sample project, if possible, and a CPU snapshot, as described here, to our e-mail address (clion-support at jetbrains.com).

0

Anna,

Since 2017.3 RC1, (or RC2??)  it seems the situation has improved! Now, I get a reasonable CPU usage when I am modifying code and 0 usage after a while if I am working in other programs.

I hope it addresses the issues for others, but, now my co-workers have also noticed it and are now happy to use CLion.

-1

CLion 2018.1
Build #CL-181.4203.549, built on March 26, 2018
JRE: 1.8.0_152-release-1136-b20 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.3

 

I still experience high CPU usage when editing files. I'm not compiling, IDE is not indexing anything but CPU usage varies from 100% to 150%. My Macbook wants to fly away. I've sent CPU snapshot to JetBrains support.

1

Same for me. I have been encountering Clion performance problems for several months now. I have just a scratch of a project with only 2 unit tests (Boost.Test) written to check the setup, but when I try to write or edit some code processor usage increases to 70-90%. I've increased memory and now it is about 6GB. Clion takes at most 2 GB, but shortly after the peak moment it drops to just about 400 MB.

CLion 2018.1.1
Build #CL-181.4445.84, built on April 10, 2018
JRE: 1.8.0_152-release-1136-b27 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.4

 

0

I also have horrible CPU usage with CLion on my medium sized (<100,000 lines) project. Even when browsing code (not even editing!) CPU usage regularly hits 400%. Sometimes when I start writing the name of a template method CLion just crashes, forcing me to 'force quit', which looses all my changes after my last save. I've tried increasing available memory to JRE.

 

CLion 2018.1.3
Build #CL-181.5087.36, built on May 23, 2018
JRE: 1.8.0_152-release-1136-b39 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.4

0

Dear all!

Please try using CLion 2018.2 EAP, it contains some performance improvements.

If you still experience performance problems in it, please send a CPU snapshot if you manage to capture it or, in case of complete freeze, some thread dumps along with zipped contents of logs folder (`Help| Show Log in …`) to our e-mail address (clion-support at jetbrains.com) when the issue happens next time.

0

I opened an issue in YT for this https://youtrack.jetbrains.com/issue/CPP-13159. Please +1 the issue.

-2
Avatar
Permanently deleted user

Hi Hardincm, Please check your link. I think that's the wrong topic for that thread.

0
Avatar
Permanently deleted user

Guys, I'm in the evaluation of CLION. I'm facing the same issue with my 6 months old MBP and High Sierra as well as 16GB RAM. A constant load of 92-96% of CPU.

I have no Plugins running. That a bad start for an evaluation.

0

Dear all,

Please note that high CPU usage may be caused by a lot of different reasons. In order to find out why CLion behaves this way in your particular case, we need some additional information. So please provide the materials described in this comment to clion-support at jetbrains.com, if you want your issue to be investigated. Thank you.

0

After having seen the CPU hog issue fixed, it is back in CLion 2018.3 EAP.

I hope it gets fixed before release. This makes using CLion impractical again....

0

Please sign in to leave a comment.