CLion uses system memory excessively
Asked Answered
A

4

11

I recently started to use CLion, on Windows 7 64-bit, for editing C files.

One thing that bothers me a lot is that it uses too much system memory. It doesn't cause out of memory error as asked in another question. Actually CLion shows much lesser memory consumption in IDE (~500 mb out of ~2000 mb) than it takes from system (~1000 mb). You can see a snapshot of the system memory usage and CLion's memory display below:

enter image description here

I use CLion not for C++ but for C projects. My project isn't that big (~5 c files < 300 lines and ~10 h files). I don't use it to compile the project, I just use it for editing. And during the snapshot there was no user program running by it. And CLion wasn't showing any processes running (indexing etc). It is a general behaviour.

I'm not sure if what I experience is something expected/normal, or it is caused because of my system setup, project settings or the way I use the IDE.

Is there any known causes for excessive memory usage? Can you suggest practices to decrease memory usage?

Amboina answered 8/4, 2016 at 10:51 Comment(0)
T
6

The post is 2 years old, but I am also having this issue with CLion 2018.1, and I imagine, others do, too. Some tips that worked for me:

  • Excluding directories from indexing.
  • Deleting source files I don't need.
  • Resolving a circular dependency between two classes. (Note: I can't vouch it was exactly that, because I tried several things at once, and it seems odd that such a powerful IDE would be affected by such an issue, but I can't rule it out.)
  • If it's really bad, the indexing can be paused. Guaranteed to reduce the memory usage. Of course, the intelligent completion won't work then.

Currently the RAM usage is stable at ~1 Gb with RocksDB, RapidJson, and ~50 classes.

UPDATE: tweaking clion64.exe.vmoptions reduced the consumption radically.

Timepleaser answered 11/4, 2018 at 11:55 Comment(4)
What vmoptions did you use to reduce memory usage?Pierpont
Sorry, @M2X, that was over a year ago! Since then a new version emerged. From my very vague recollection, stack, mx, that sort of thing. But I can't vouch for that.Timepleaser
Thanks @Vadim Berman. Yeah, issue is every single version consumes a lot of memory. Those values you mentioned, I've tweaked in the past... Didn't make things much betterPierpont
-Xmx2048m for me at least setting the max memory in custom vm option in CLion can use helpedOui
Z
2

Same issue here. I haven't used CLion just sitting there so that I do not have to open again, 2 projects few files open, nothing major, still eating up +3GB is not something that I can accept, switching back to Sublime, that works fine, as others have mentioned I am using it only for editing/refactoring, compilation happens in Terminal.

(PyCharm has similar issues)

enter image description here

Zug answered 4/5, 2017 at 12:38 Comment(0)
S
0

CLion need to index and support all information about the system headers to provide you smart completion, auto-import and symbol resolution. Your project is the smallest part of code base for analyzing.

Snapp answered 12/4, 2016 at 19:32 Comment(3)
Thank you for information. Does it mean that my experience is expected behaviour? Do you experience similar or higher memory usage?Amboina
yes, it is. CLean is the only JB IDE, that has not 32bit version. Just because. ~16GB for WebKit or Unreal Engine is ok. Memory usage is uneven. The initial indexing is memory-expensive as well as data-flow analysis (finding unused code).Snapp
1000mb for editing 5 files is actually unacceptable. I have the same issue and think I'll switch back to using VIM.Serve
C
0

I have heard about version 2020.3, which brings option to switch off refreshing files. https://intellij-support.jetbrains.com/hc/en-us/community/posts/360007093580-How-to-disable-refreshing-files-after-build Unfortunately I cannot try it out in my professional development environment.

Closelipped answered 12/1, 2021 at 14:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.